Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ad background image with tkinter

app = Tk()
app.title("Welcome")
image2 =Image.open('C:UsersadminpDesktop	itlepagefront.gif')
image1 = ImageTk.PhotoImage(image2)
w = image1.width()
h = image1.height()
app.geometry('%dx%d+0+0' % (w,h))
#app.configure(background='C:Usfront.png')
#app.configure(background = image1)

labelText = StringVar()
labelText.set("Welcome !!!!")
#labelText.fontsize('10')

label1 = Label(app, image=image1, textvariable=labelText,
               font=("Times New Roman", 24),
               justify=CENTER, height=4, fg="blue")
label1.pack()

app.mainloop()
Comment

ad background image with tkinter


background_image=tk.PhotoImage(...)
background_label = tk.Label(parent, image=background_image)
background_label.place(x=0, y=0, relwidth=1, relheight=1)

Comment

How To Display A Background Image With Tkinter

Import tkinter
from tkinter import *
from PIL import Image, ImageTk

root = Tk()

# Create a photoimage object of the image in the path
image1 = Image.open("<path/image_name>")
test = ImageTk.PhotoImage(image1)

label1 = tkinter.Label(image=test)
label1.image = test

# Position image
label1.place(x=<x_coordinate>, y=<y_coordinate>)
root.mainloop()
Comment

how to create background images in tkinter

# Import module 
from tkinter import *
  
# Create object 
root = Tk()
  
# Adjust size 
root.geometry("400x400")
  
# Add image file
bg = PhotoImage(file = "Your_image.png")
  
# Show image using label
label1 = Label( root, image = bg)
label1.place(x = 0, y = 0)
  
label2 = Label( root, text = "Welcome")
label2.pack(pady = 50)
  
# Create Frame
frame1 = Frame(root)
frame1.pack(pady = 20 )
  
# Add buttons
button1 = Button(frame1,text="Exit")
button1.pack(pady=20)
  
button2 = Button( frame1, text = "Start")
button2.pack(pady = 20)
  
button3 = Button( frame1, text = "Reset")
button3.pack(pady = 20)
  
# Execute tkinter
root.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: html.unescape python 
Python :: when button is clicked tkinter python 
Python :: python epoch to datetime 
Python :: flask tutorials 
Python :: how to use pafy 
Python :: convert numpy array to cv2 image 
Python :: label encoding in python 
Python :: python using datetime as id 
Python :: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True) 
Python :: install tensorflow gpu 
Python :: discord.py get channel id by channel name 
Python :: python convert from float to decimal 
Python :: create a blank image cv2 
Python :: pandas add quantile columns 
Python :: Python Django Models Unique Rows 
Python :: python find object with attribute in list 
Python :: find different between list 
Python :: sending whatsapp message using python 
Python :: french to english 
Python :: how to convert the date column from string to a particular format in python 
Python :: python socket recv set timeout 
Python :: pandas dataframe get number of occurrence in column 
Python :: tensor vs numpy array 
Python :: replace nan numpy array 
Python :: python foreach list 
Python :: plot a circle in python using equation of a circle 
Python :: kivy change window size 
Python :: pytorch unsqueeze 
Python :: tensorflow keras load model 
Python :: how to import numpy in python 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =