Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. sunPic = r'sun.gif'
  2. mercPic = r'merc.gif'
  3.  
  4.  
  5. buttonFrame = Frame(root)
  6. buttonFrame.pack(side=LEFT)
  7.  
  8. textFrame = Frame(root)
  9. textFrame.pack(side=TOP)
  10.  
  11.  
  12. def sunInfo():
  13. textFrame.destroy()
  14. sunImage = PhotoImage(file=sunPic)
  15. img1 = Label(textFrame, image = sunImage)
  16. img1.pack()
  17. img1.image = sunImage
  18.  
  19. def mercInfo():
  20. textFrame.destroy()
  21. mercImage = PhotoImage(file=mercPic)
  22. img2 = Label(textFrame, image = mercImage).pack()
  23. img2.image = mercImage
  24.  
  25.  
  26.  
  27. sun = Button(buttonFrame, text="THE SUN",command=sunInfo)
  28. sun.pack(side=TOP)
  29.  
  30. mercury = Button(buttonFrame, text="MERCURY",command=mercInfo)
  31. mercury.pack(side=TOP)
  32.  
  33. Exception in Tkinter callback
  34. Traceback (most recent call last):
  35. File "C:Python33libtkinter__init__.py", line 1475, in __call__
  36. return self.func(*args)
  37. File "C:UsersRyanDesktoppythonProjects for ParliamentuniverseinfoUniverse.py", line 30, in sunInfo
  38. img1 = Label(textFrame, image = sunImage)
  39. File "C:Python33libtkinter__init__.py", line 2596, in __init__
  40. Widget.__init__(self, master, 'label', cnf, kw)
  41. File "C:Python33libtkinter__init__.py", line 2075, in __init__
  42. (widgetName, self._w) + extra + self._options(cnf))
  43. _tkinter.TclError: bad window path name ".45448776"
  44.  
  45. def sunInfo():
  46. textFrame.pack_forget()
  47. sunImage = PhotoImage(file=sunPic)
  48. img1 = Label(textFrame, image = sunImage)
  49. img1.image = sunImage
  50. img1.pack()
  51.  
  52.  
  53. def mercInfo():
  54. textFrame.pack_forget()
  55. mercImage = PhotoImage(file=mercPic)
  56. img2 = Label(textFrame, image = mercImage)
  57. img2.image = mercImage
  58. img2.pack()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement