| | |
GUI def destroying
![]() |
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 0
hey guys im trying to work this out for a school assignment, i cant get the destroy function to work whith the button i created, heres mycode see if you can look at it and tell me whas wrong
python Syntax (Toggle Plain Text)
import Tkinter as tk root = tk.Tk() root.title('background image') def qwerty(): self.destroy(button2) #def qwerty(): image1 = tk.PhotoImage(file="Black.gif") w = image1.width() h = image1.height() panel1.image = image1 root.geometry("%dx%d+0+0" % (w, h)) panel1 = tk.Label(root, image=image1) panel1.pack(side='top', fill='both', expand='yes') self.button2 = tk.Button(panel1, text='Click here to continue', command = qwerty) self.button2.pack(side='bottom') root.mainloop()
•
•
Join Date: May 2008
Posts: 538
Reputation:
Solved Threads: 86
The code you posted wouldn't even compile, let alone run.
Please be specific in the problem you are having.
I think the following is close to what you wanted, but it uses global variables which have their own problems:
Please be specific in the problem you are having.
I think the following is close to what you wanted, but it uses global variables which have their own problems:
Python Syntax (Toggle Plain Text)
import Tkinter as tk root = tk.Tk() root.title('background image') def qwerty(): button2.destroy() #def qwerty(): image1 = tk.PhotoImage(file="Black.gif") w = image1.width() h = image1.height() #panel1.image = image1 root.geometry("%dx%d+0+0" % (w, h)) panel1 = tk.Label(root, image=image1) panel1.pack(side='top', fill='both', expand='yes') button2 = tk.Button(panel1, text='Click here to continue', command = qwerty) button2.pack(side='bottom') root.mainloop()
![]() |
Similar Threads
- Looping action while button is pushed in Glade (Python)
- Python Error (Python)
- Uni Project help (Python)
- Tkinter Addressbook (Python)
- Stuck in GUI (Python)
- Trying to get card images into a GUI (Python)
- Python GUI build: Logic Complications and Mistakes (Python)
- pygtk Glade GUI freezes (Python)
- TURN THIS ASSIGNMENT UserID INTO GUI, CAN YOU HELP ME (Python)
Other Threads in the Python Forum
- Previous Thread: Can I integrate Python and the web?
- Next Thread: Cross-platform console manipulation
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog cx-freeze data decimals dictionaries dictionary directory dynamic error examples exe file float format function gnu graphics gui heads homework http ideas import input itunes java launcher leftmouse line linux list lists loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite ssh statistics string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable ventrilo wikipedia write wxpython xlib





