0

I am new to programming and I use Python 3.2.

I have started to make a very simple GUI program (added a couple of labels and buttons). I have a couple of questions:

  • How do I add a background to the window where I have my widgets?

  • How do I make the program exit a window if one button is pressed?

I hope these questions haven't been answered before, spent a couple of minutes searching here.

Thanks for your time!

Charles
  • 50,943
  • 13
  • 104
  • 142
Mic
  • 1

2 Answers2

1

Tkinter doesn't directly support background images. However, what you can do is create a label or canvas widget, load the image to that, and then use that widget as the container for all other widgets. You'll have to manually handle the tiling or stretching of the image yourself, however.

The question about exiting has been answered before: Python: How can I make my tkinter app exit properly? and Close a tkinter window?

Community
  • 1
  • 1
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
-1

I suggest you to use pyGTK if you want

http://www.pygtk.org

http://www.linuxjournal.com/article/6586

macki
  • 904
  • 7
  • 12
  • I'm sorry, but I down-voted because this doesn't address the question at all. All you're saying is "dude, I think you chose the wrong GUI toolkit because it's not my favorite one". If you at least make an attempt to say *why* someone should switch, and address their actual question (ie: "here's how to add a background image with pygtk: .."), your answer will have a much better chance of not being down-voted. – Bryan Oakley Nov 17 '11 at 22:19