How To Take A Image As A Background In Tkinter In Python Code Example

Snippet 1
  from tkinter import *
from tkinter import messagebox
top = Tk()

C = Canvas(top, bg="blue", height=250, width=300)
filename = PhotoImage(file = "C:\\Users\\location\\imageName.png")
background_label = Label(top, image=filename)
background_label.place(x=0, y=0, relwidth=1, relheight=1)

C.pack()
top.mainloop 
Snippet 2
  app = Tk()
app.title("Welcome")
image2 =Image.open('C:\\Users\\adminp\\Desktop\\titlepage\\front.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() 

Similar Snippets


How To Take A Image As A Background In Tkinter In Python Code Example - java

Js How To Prevent A Code From Runing Code Example - java

How To Round A Number Javascript Code Example - java

Java How To Get Files In Resources Code Example - java

Simpledateformat Example Java Code Example - java

While Loop Continue Js Code Example - java

Find Duplicates In Arraylist Java Code Example - java

Java Get Random Index From Array Code Example - java

Firestore Find Doc And Set Data Code Example - java

Array Fot String Code Example - java

For Each Javascript Code Example - java

Java Creat A Folder Code Example - java

Different Types Of Writing If Else Statements Jav Code Example - java

Remove Last Letter From String Java Code Example - java

Create Copy Of Array From Another Array Code Example - java

Creating Java Main Method Code Example - java

Switch Case Accepts Byte In Java Code Example - java

Find Duplicate And Repeating Number In Array Code Example - java