Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. def __init__(self):
  4. self.root = Tk()
  5. self.width = 800
  6. self.height = 400
  7. self.root.geometry("{}x{}".format(self.width, self.height))
  8. self.root.resizable(False, False)
  9. self.menu_bar()
  10. self.tool_bar()
  11. self.name = Label(self.root, text="Tester", bg="black", fg="white")
  12.  
  13. self.root.mainloop()
  14.  
  15. def menu_bar(self):
  16. self.menu = Menu(self.root)
  17. self.root.config(menu=self.menu)
  18. self.subMenu = Menu(self.menu)
  19. self.menu.add_cascade(label="File", menu=self.subMenu)
  20. self.subMenu.add_command(label="New Project...")
  21. self.subMenu.add_command(label="Properties")
  22. self.subMenu.add_separator()
  23. self.subMenu.add_command(label="Do nothing")
  24.  
  25. def tool_bar(self):
  26. self.toolbar = Frame(self.root, bg="#555555")
  27. self.insert_button = Button(self.toolbar, text="Insert", bg="#555555", fg="white", activeforeground="white",
  28. activebackground="#008CBA", borderwidth=0)
  29. self.insert_button.grid(row=0, column=0)
  30.  
  31. self.print_buttom = Button(self.toolbar, text="Print", bg="#555555", fg="white", activeforeground="white",
  32. activebackground="#008CBA", borderwidth=0,
  33. command=self.root.quit)
  34. self.print_buttom.grid(row=0, column=1)
  35. self.toolbar.grid(row=0, column=0, sticky=EW)
  36.  
  37.  
  38. if __name__ == '__main__':
  39. App()
  40.  
  41. class App:
  42.  
  43. def __init__(self):
  44. self.root = Tk()
  45. ...
  46. self.root.columnconfigure(0,weight=1)
  47. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement