Advertisement
xample

Main GUI

Jan 28th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.03 KB | None | 0 0
  1. import tkinter as tk
  2. from tkinter import *
  3. def StartMove(self, event):
  4.         try:
  5.                 self.TKroot.x = event.x
  6.                 self.TKroot.y = event.y
  7.         except:
  8.                 pass
  9.  
  10. def StopMove(self, event):
  11.         try:
  12.                 self.TKroot.x = None
  13.                 self.TKroot.y = None
  14.         except:
  15.                 pass
  16.  
  17. def OnMotion(self, event):
  18.         try:
  19.                 deltax = event.x - self.TKroot.x
  20.                 deltay = event.y - self.TKroot.y
  21.                 x = self.TKroot.winfo_x() + deltax
  22.                 y = self.TKroot.winfo_y() + deltay
  23.                 self.TKroot.geometry("+%s+%s" % (x, y))
  24.         except:
  25.                 pass
  26.  
  27.  
  28. class MainMenu(tk.Frame):
  29.     def __init__(self, master = None):
  30.         tk.Frame.__init__(self, master)
  31.         self.page_main_settings()
  32.         self.FrameWindowTop()
  33.         #self.MainMenu_Code()
  34.  
  35.     def page_main_settings(self):
  36.         self.master.geometry("900x600+400+200") # W x H
  37.         self.master.resizable(height = True, width = True)
  38.         self.master.title("Main Menu")
  39.         self.master.protocol("WM_DELETE_WINDOW", lambda:self.master.withdraw())
  40.         self.master.attributes('-topmost', True)
  41.         self.master.configure(background  = 'darkblue')
  42.         self.master.overrideredirect(1)
  43.     def FrameWindowTop(self):
  44.         def mainmenu_trigger():
  45.             Trigger_Codes(request = 'MainMenuRequest')
  46.         def accountmenu_trigger():
  47.             Trigger_Codes(request = 'AccountMenuRequest')
  48.  
  49.         topframe = tk.Frame(self.master, width = 150, bg = 'white', height = 50, relief = 'sunken', borderwidth = 2)
  50.         topframe.configure(bg = 'black')
  51.         topframe.pack(expand = True, fill  = 'x', anchor = 'n')
  52.         button_main_page = tk.Button(topframe, text = "Main Menu", command = mainmenu_trigger)
  53.         button_main_page.configure(bg = 'black', fg  = 'white', font =('Times', 15, 'bold'), borderwidth = 0)
  54.         button_main_page.place(x  = 0, y = 0)
  55.  
  56.         button_main_page_account = Button(topframe, text = 'Account', command = accountmenu_trigger)
  57.         button_main_page_account.configure(bg = 'black', fg  = 'white', font =('Times', 15, 'bold'), borderwidth = 0)
  58.         button_main_page_account.place(x = 120, y = 0)
  59.  
  60.         button_main_page_exit = Button(topframe, text = 'X', command = lambda:self.master.destroy())
  61.         button_main_page_exit.configure(bg = 'black', fg  = 'white', font =('Times', 18, 'bold'), borderwidth = 0)
  62.         button_main_page_exit.place(x = 860, y = 0, width  = 40)
  63.  
  64.         button_main_page_withdraw = Button(topframe, text = '_', command = lambda:self.master.withdraw())
  65.         button_main_page_withdraw.configure(bg = 'black', fg  = 'white', font =('Times', 15, 'bold'), borderwidth = 0)
  66.         button_main_page_withdraw.place(x = 800, y = 0, width = 40)
  67.  
  68.  
  69.  
  70.  
  71. request = None
  72. class Trigger_Codes():
  73.     def __init__(self, request):
  74.         self.request = request
  75.         self.trigger_menus(request)
  76.     def trigger_menus(self, request):
  77.         if request == 'MainMenuRequest':
  78.             self.MainMenu_Code()
  79.         if request == 'AccountMenuRequest':
  80.             self.AccountMenu_Code()
  81.     def AccountMenu_Code(self):
  82.         global main_label_account,running_status,running_acc_status
  83.         if running_status == True:
  84.             print ("Running")
  85.             main_label.lower()
  86.             account_label.lower()
  87.             password_label.lower()
  88.             website_label.lower()
  89.             note_label.lower()
  90.         main_label_account = Label(main_gui, text = 'Account Settings')
  91.         main_label_account.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  92.         main_label_account.place(x = 0, y = 50, width = 900)
  93.         running_acc_status = True
  94.         running_status = False
  95.     def MainMenu_Code(self):
  96.         global running_status,main_label, account_label,password_label,website_label,note_label
  97.         try:   
  98.             if running_status == False:
  99.                 main_label_account.lower()
  100.                 try:
  101.                     main_label.lift()
  102.                     account_label.lift()
  103.                     password_label.lift()
  104.                     website_label.lift()
  105.                     note_label.lift()
  106.                 except:
  107.                     pass
  108.         except:
  109.             pass
  110.         main_label = Label(main_gui, text = "Password Manager Stored Passwords")
  111.         main_label.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  112.         main_label.place(x = 0, y = 50, width = 900)
  113.  
  114.         account_label  = Label(main_gui, text = "Accounts")
  115.         password_label = Label(main_gui, text = "Passwords")
  116.         website_label = Label(main_gui, text = "Website")
  117.         note_label = Label(main_gui, text = "Note")
  118.  
  119.         account_label.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  120.         password_label.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  121.         website_label.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  122.         note_label.configure(bg = 'darkblue', fg = 'white', font=('Times', 20, 'underline', 'bold'))
  123.  
  124.         account_label.place(x = 0, y = 100, width = 120)
  125.         password_label.place(x = 200, y = 100, width = 120)
  126.         website_label.place(x = 400, y = 100, width = 120)
  127.         note_label.place(x = 600, y = 100, width = 120)
  128.         running_status = True
  129.  
  130.  
  131. main_gui = tk.Toplevel()
  132.  
  133. Trigger_Codes(request = 'MainMenuRequest')
  134. main_app = MainMenu(master = main_gui)
  135. main_gui.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement