Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import tkinter as tk
  3. #
  4. # main application
  5. #
  6. class MainApp(tk.Frame):
  7. def __init__(self, parent):
  8. tk.Frame.__init__(self, parent)
  9. self.parent = parent
  10. self.parent.title("My first GUI")
  11. self.parent.geometry("480x320")
  12. self.parent.resizable(width=False, height=False)
  13. self.parent.config(bg="yellow")
  14.  
  15. mainframe = tk.Frame(self, bg="grey", width=480, height=280 )
  16. mainframe.grid(column=0, row=0, sticky="WENS")
  17. tk.Label(mainframe, text="co-cooo").grid(column=0, row=0, sticky="WENS")
  18.  
  19. fkeyframe = tk.Frame(self, bg="black", width=480, height=40)
  20. fkeyframe.grid(column=0, row=1, sticky="WENS")
  21. tk.Label(fkeyframe, text="fo-fooo").grid(column=0, row=0, sticky="WENS")
  22.  
  23. self.rowconfigure(0, weight=1, minsize=280)
  24. self.rowconfigure(1, weight=1, minsize=40)
  25. #
  26. # define root element and start application
  27. #
  28. def main():
  29. root = tk.Tk()
  30. app = MainApp(root)
  31. root.mainloop()
  32.  
  33. #
  34. # start if called from command line
  35. #
  36. if __name__ == '__main__':
  37. main()
  38.  
  39. # 0,0 MainApp (yellow) 480,0
  40. # +---------------------------------+
  41. # | mainframe (grey, h=280) |
  42. # |+-------------------------------+|
  43. # || ||
  44. # || ||
  45. # || ||
  46. # |+-------------------------------+|
  47. # | fkeyframe (black, h=40) |
  48. # |+-------------------------------+|
  49. # ||+----+----+----+----+----+----+||
  50. # ||| Bt | Bt | Bt | Bt | Bt | Bt |||
  51. # ||+----+----+----+----+----+----+||
  52. # |+-------------------------------+|
  53. # +---------------------------------+
  54. # 320,0 320,480
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement