Advertisement
ALEXANDAR_GEORGIEV

car_main

Jun 5th, 2023 (edited)
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.50 KB | Source Code | 0 0
  1. import tkinter as tk
  2.  
  3. # from new_company import *
  4. # from accountant import *
  5.  
  6. class Main:
  7.     def __init__(self):
  8.         pass
  9.  
  10.     def new_data(self):
  11.         self.new_button["state"] = "disabled"  # Butona e zabranen пък пак работи ???
  12.         self.car_prop = CarProperties()
  13.         self.car_prop.props()
  14.  
  15.     def main(self):
  16.         self.root = tk.Tk()
  17.         w = 500
  18.         h = 160
  19.         self.root.geometry(f"{w}x{h}+0+0")
  20.         self.root.title("УПРАВЛЕНИЕ НА МОТОРНИ ПРЕВОЗНИ СРЕДСТВА")
  21.         # screen_width = root.winfo_screenwidth()
  22.         self.frame_up = tk.Frame(self.root, )
  23.         self.frame_up.grid(row=0, column=0, sticky="ew", pady=(2, 20), padx=(2, 10))
  24.         self.new_button = tk.Button(self.frame_up, text="НОВ", fg="darkgreen", activebackground="orange", font="Timesbd",
  25.                                     highlightcolor="purple",  relief='raised', width=10, height=1, command=self.new_data)
  26.         self.new_button.grid(row=0, column=0, padx=2, pady=2)
  27.  
  28.         self.root.mainloop()
  29.  
  30.  
  31.  
  32. class CarProperties:
  33.     def __init__(self):
  34.         self.properties = tk.Tk()
  35.         self.properties.title("Информация за автомобила")
  36.         screen_width = self.properties.winfo_screenwidth()
  37.         screen_height = self.properties.winfo_screenheight()
  38.         w, h = 800, 500
  39.         print(f"{screen_width} x {screen_height}")
  40.         self.properties.geometry(f"800x500+{int(screen_width / 2 - w / 2)}+{int(screen_height / 2 - h / 2)}")
  41.         self.screen_width = self.properties.winfo_screenwidth()
  42.         self.properties.attributes('-topmost', True)
  43.         # TODO -> Бутона НОВ да се забрани!
  44.  
  45.  
  46.  
  47.         #self.props()
  48.  
  49.     def create_icon(self):
  50.         pass
  51.  
  52.     def save_b(self):
  53.         pass
  54.  
  55.     def props(self):
  56.         # TODO -> Frames
  57.         frame_data = tk.Frame(self.properties, width=700, height=400, relief="groove", borderwidth=5,)
  58.         frame_data.grid(row=0, column=0, sticky="ewns", pady=(0, 20))
  59.         frame_bottom = tk.Frame(self.properties, width=100, height=100, borderwidth=5)
  60.         frame_bottom.grid(row=1, column=0, columnspan=2, sticky="ewns")
  61.         frame_right = tk.Frame(self.properties, width=100, height=100, borderwidth=5)
  62.         frame_right.grid(row=0, column=1, rowspan=2, sticky="ewns")
  63.  
  64.         # TODO -> Labels
  65.         reg_number_l = tk.Label(frame_data, text="Регистрационен номер:", )
  66.         reg_number_l.grid(row=0, column=0, padx=20, pady=(10), sticky="w")
  67.         model_l = tk.Label(frame_data, text="Модел:")
  68.         model_l.grid(row=1, column=0, padx=20, pady=(10), sticky="w")
  69.         tank_l = tk.Label(frame_data, text="Обем на резервоара (л):")
  70.         tank_l.grid(row=2, column=0, padx=20, pady=(10), sticky="w")
  71.         fuel_rate_l = tk.Label(frame_data, text="Разходна норма (л/100км):")
  72.         fuel_rate_l.grid(row=3, column=0, padx=20, pady=(10, 10), sticky="w")
  73.         fuel_type_l = tk.Label(frame_data, text="Гориво:")
  74.         fuel_type_l.grid(row=4, column=0, padx=20, pady=(10, 10), sticky="w")
  75.         service_l = tk.Label(frame_data, text="Годишен технически преглед (дата):")
  76.         service_l.grid(row=5, column=0, padx=20, pady=(10, 10), sticky="w")
  77.  
  78.  
  79.         # TODO -> Entry
  80.         reg_number_e = tk.Entry(frame_data, width=12, justify='right')
  81.         reg_number_e.grid(row=0, column=1, padx=10, pady=10, sticky="w")
  82.         model_e = tk.Entry(frame_data, width=30, justify='center')
  83.         model_e.grid(row=1, column=1, padx=10, pady=10, sticky="w")
  84.         tank_e = tk.Entry(frame_data, width=4, justify='center')
  85.         tank_e.grid(row=2, column=1, padx=10, pady=10, sticky="w")
  86.         fuel_rate_e = tk.Entry(frame_data, width=4, justify='center')
  87.         fuel_rate_e.grid(row=3, column=1, padx=10, pady=10, sticky="w")
  88.         fuel_type_e = tk.Entry(frame_data, width=15, justify='center')
  89.         fuel_type_e.grid(row=4, column=1, padx=10, pady=10, sticky="w")
  90.         service_e = tk.Entry(frame_data, width=15, justify='center')
  91.         service_e.grid(row=5, column=1, padx=10, pady=10, sticky="w")
  92.  
  93.  
  94.         # TODO -> Buttons
  95.         save_b = tk.Button(frame_bottom, text="ЗАПИС", fg="blue")
  96.         save_b.grid(row=0, column=0)
  97.  
  98.         # TODO -> Бутона НОВ да се разреши!
  99.  
  100.         self.properties.mainloop()
  101.  
  102.  
  103. if __name__ == '__main__':
  104.     start = Main()
  105.     start.main()
  106.  
  107.  
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement