Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. import tkinter as tk
  2. class PokemonDecklistCreatorApp(tk.Tk):
  3. def __init__(self, *args, **kwargs):
  4. tk.Tk.__init__(self, *args, **kwargs)
  5. container = tk.Frame(self)
  6. container.pack(side="top", fill="both", expand=True)
  7. container.grid_rowconfigure(0, weight=1)
  8. container.grid_columnconfigure(0, weight=1)
  9.  
  10. self.frames = {}
  11. for F in (MainMenu, DecksMenu, SearchMenu, ExtrasMenu):
  12. frame = F(parent=container, controller=self)
  13. self.frames[F] = frame
  14. frame.grid(row=0, column=0, sticky="nsew")
  15. self.show_frame(MainMenu)
  16.  
  17. def show_frame(self, page_name):
  18. frame = self.frames[page_name]
  19. frame.tkraise()
  20.  
  21. def quitProg(self):
  22. app.destroy()
  23.  
  24. class MainMenu(tk.Frame):
  25. def __init__(self, parent, controller):
  26. tk.Frame.__init__(self, parent)
  27. self.controller = controller
  28.  
  29. self.btnDecksMenu = tk.Button(self,text = "Decks Menu", command = lambda: controller.show_frame(DecksMenu)), width = 300, height = 150)
  30. self.btnDecksMenu.place(x = 200, y = 385)
  31.  
  32. self.btnSearchMenu = tk.Button(self, text = "Search Menu", command = self.searching), width = 300, height = 150)
  33. self.btnSearchMenu.place(x = 550, y = 385)
  34.  
  35. self.btnExtrasMenu = tk.Button(self, text = "Extras Menu", command = lambda: controller.show_frame(ExtrasMenu)), width = 300, height = 150)
  36. self.btnExtrasMenu.place(x = 900, y = 385)
  37.  
  38. self.btnQuitProg = tk.Button(self, text = "Quit Program", command = controller.quitProg), width = 75, height = 25)
  39. self.btnQuitProg.place(x = 1200, y = 700)
  40.  
  41. def searching(self):
  42. #CardViewerSearchResults.setDeck("None")
  43. lambda: controller.show_frame(SearchMenu)
  44.  
  45. class DecksMenu(tk.Frame):
  46. def __init__(self, parent, controller):
  47. tk.Frame.__init__(self, parent)
  48. self.controller = controller
  49.  
  50. class SearchMenu(tk.Frame):
  51. def __init__(self, parent, controller):
  52. tk.Frame.__init__(self, parent)
  53. self.controller = controller
  54.  
  55. class ExtrasMenu(tk.Frame):
  56. def __init__(self, parent, controller):
  57. tk.Frame.__init__(self, parent)
  58. self.controller = controller
  59.  
  60. app = PokemonDecklistCreatorApp()
  61. app.geometry("1400x788")
  62. app.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement