Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. from tkinter import as tk
  2. from tkinter import filedialog
  3.  
  4. class SampleApp(tk.Tk):
  5. def __init__(self):
  6. tk.Tk.__init__(self)
  7. self.container = tk.Frame(self)
  8. self.container.pack(side="top", fill="both", expand=True)
  9. self._frame = PageFour(master=self.container, controller=self)
  10.  
  11. def switch_frame(self, frame_class):
  12. new_frame = frame_class(master=self.container, controller=self)
  13. self._frame.destroy()
  14. self._frame = new_frame
  15.  
  16. root = Tk()
  17. root.geometry('600x600')
  18.  
  19. theLabel = Label(root, text='Deseja iniciar o Ciclo de Cura do Autoclave?')
  20. theLabel.pack()
  21.  
  22. x1 = Button(root)
  23. photo = PhotoImage(file=u'C:\Users\Tiago\Desktop\Dudu\Pics\green1.gif')
  24. x1.config(image=photo, width='400', height='400', activebackground='black', bg='black', bd=0,
  25. command=lambda: controller.switch_frame(PageFive))
  26. x1.pack()
  27.  
  28. x2 = Button(root)
  29. photo = PhotoImage(file=u'C:\Users\Tiago\Desktop\Dudu\Pics\red.gif')
  30. x2.config(image=photo, width='400', height='400', activebackground='black', bg='black', bd=0)
  31. x2.pack()
  32.  
  33. class PageFive(tk.Frame):
  34. def __init__(self, master, controller):
  35. tk.Frame.__init__(self, master)
  36. self.controller = controller
  37.  
  38. page_2_label = tk.Label(self, text="Página 5")
  39. page_2_label.pack(side="top", fill="x", pady=10)
  40. self.pack()
  41.  
  42.  
  43. if __name__ == "__main__":
  44. app = SampleApp()
  45. app.mainloop()
  46.  
  47. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement