Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sunPic = r'sun.gif'
- mercPic = r'merc.gif'
- buttonFrame = Frame(root)
- buttonFrame.pack(side=LEFT)
- textFrame = Frame(root)
- textFrame.pack(side=TOP)
- def sunInfo():
- textFrame.destroy()
- sunImage = PhotoImage(file=sunPic)
- img1 = Label(textFrame, image = sunImage)
- img1.pack()
- img1.image = sunImage
- def mercInfo():
- textFrame.destroy()
- mercImage = PhotoImage(file=mercPic)
- img2 = Label(textFrame, image = mercImage).pack()
- img2.image = mercImage
- sun = Button(buttonFrame, text="THE SUN",command=sunInfo)
- sun.pack(side=TOP)
- mercury = Button(buttonFrame, text="MERCURY",command=mercInfo)
- mercury.pack(side=TOP)
- Exception in Tkinter callback
- Traceback (most recent call last):
- File "C:Python33libtkinter__init__.py", line 1475, in __call__
- return self.func(*args)
- File "C:UsersRyanDesktoppythonProjects for ParliamentuniverseinfoUniverse.py", line 30, in sunInfo
- img1 = Label(textFrame, image = sunImage)
- File "C:Python33libtkinter__init__.py", line 2596, in __init__
- Widget.__init__(self, master, 'label', cnf, kw)
- File "C:Python33libtkinter__init__.py", line 2075, in __init__
- (widgetName, self._w) + extra + self._options(cnf))
- _tkinter.TclError: bad window path name ".45448776"
- def sunInfo():
- textFrame.pack_forget()
- sunImage = PhotoImage(file=sunPic)
- img1 = Label(textFrame, image = sunImage)
- img1.image = sunImage
- img1.pack()
- def mercInfo():
- textFrame.pack_forget()
- mercImage = PhotoImage(file=mercPic)
- img2 = Label(textFrame, image = mercImage)
- img2.image = mercImage
- img2.pack()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement