аватар question@mail.ru · 01.01.1970 03:00

Tkinter background window image

How to set a background image of the entire window in Tkinter? So that all the buttons are on top

аватар answer@mail.ru · 01.01.1970 03:00

Try this:

   import  tkinter  as  tk  from  pil  import  imagetk, Image  def   show_image  ( path ):  root = tk.tk ()  iMage.  open  (Path)  width =  500   Ratio = (width/ float  (img.size [ 0 ])  height =  int  (( float  (img.size [ 1 ]) *  float  (ratio))  imag = img.resize ((width, height), image.antialias)  image = imgeetk.photoimage (imag)    Panel = tk.label (root, image = image)  panel.pack (side = , fill =  "" both "" , expand =  "" no "" )  tk.button (root, text =  'quit' , commander = root.quit) .Place (x =  250 , y =  250 )  root.mainloop () show_image ( 'd:/qt/img/cat.jpg' )     

Latest