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

tkinter background image python 3

You need to apply the grid method to the label that contains the image, not the image object:

bg_image = PhotoImage(file ="pic.gif")
x = Label (image = bg_image)
x.grid(row = 0, column = 0)
http://effbot.org/tkinterbook/photoimage.htm
Comment

PREVIOUS NEXT
Code Example
Python :: how to install docx in python 
Python :: tuple and list in python 
Python :: 405 status code django 
Python :: python math operators 
Python :: python compiler to exe 
Python :: depth first search python recursive 
Python :: Python Remove all occurrences of a character from a string 
Python :: Python Tkinter Text Widget Syntax 
Python :: tkinter dialog box 
Python :: python get array length 
Python :: python run powershell command and get output 
Python :: python max function with lambda 
Python :: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead 
Python :: integral python 
Python :: max int python 
Python :: create a empty dataframe 
Python :: python package for confluence 
Python :: python text reverse 
Python :: list comprehesion python 
Python :: python program to print the fibonacci sequence 
Python :: discordpy owner only command 
Python :: fibonacci recursive python 
Python :: binary gap python 
Python :: flask session timeout 
Python :: django message 
Python :: how to add coloumn based on other column 
Python :: seaborn barplot remove error bars 
Python :: z score formula in pandas 
Python :: blender show python version 
Python :: find number of unique keys in the dictionary 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =