Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- # from new_company import *
- # from accountant import *
- class Main:
- def __init__(self):
- pass
- def new_data(self):
- self.new_button["state"] = "disabled" # Butona e zabranen пък пак работи ???
- self.car_prop = CarProperties()
- self.car_prop.props()
- def main(self):
- self.root = tk.Tk()
- w = 500
- h = 160
- self.root.geometry(f"{w}x{h}+0+0")
- self.root.title("УПРАВЛЕНИЕ НА МОТОРНИ ПРЕВОЗНИ СРЕДСТВА")
- # screen_width = root.winfo_screenwidth()
- self.frame_up = tk.Frame(self.root, )
- self.frame_up.grid(row=0, column=0, sticky="ew", pady=(2, 20), padx=(2, 10))
- self.new_button = tk.Button(self.frame_up, text="НОВ", fg="darkgreen", activebackground="orange", font="Timesbd",
- highlightcolor="purple", relief='raised', width=10, height=1, command=self.new_data)
- self.new_button.grid(row=0, column=0, padx=2, pady=2)
- self.root.mainloop()
- class CarProperties:
- def __init__(self):
- self.properties = tk.Tk()
- self.properties.title("Информация за автомобила")
- screen_width = self.properties.winfo_screenwidth()
- screen_height = self.properties.winfo_screenheight()
- w, h = 800, 500
- print(f"{screen_width} x {screen_height}")
- self.properties.geometry(f"800x500+{int(screen_width / 2 - w / 2)}+{int(screen_height / 2 - h / 2)}")
- self.screen_width = self.properties.winfo_screenwidth()
- self.properties.attributes('-topmost', True)
- # TODO -> Бутона НОВ да се забрани!
- #self.props()
- def create_icon(self):
- pass
- def save_b(self):
- pass
- def props(self):
- # TODO -> Frames
- frame_data = tk.Frame(self.properties, width=700, height=400, relief="groove", borderwidth=5,)
- frame_data.grid(row=0, column=0, sticky="ewns", pady=(0, 20))
- frame_bottom = tk.Frame(self.properties, width=100, height=100, borderwidth=5)
- frame_bottom.grid(row=1, column=0, columnspan=2, sticky="ewns")
- frame_right = tk.Frame(self.properties, width=100, height=100, borderwidth=5)
- frame_right.grid(row=0, column=1, rowspan=2, sticky="ewns")
- # TODO -> Labels
- reg_number_l = tk.Label(frame_data, text="Регистрационен номер:", )
- reg_number_l.grid(row=0, column=0, padx=20, pady=(10), sticky="w")
- model_l = tk.Label(frame_data, text="Модел:")
- model_l.grid(row=1, column=0, padx=20, pady=(10), sticky="w")
- tank_l = tk.Label(frame_data, text="Обем на резервоара (л):")
- tank_l.grid(row=2, column=0, padx=20, pady=(10), sticky="w")
- fuel_rate_l = tk.Label(frame_data, text="Разходна норма (л/100км):")
- fuel_rate_l.grid(row=3, column=0, padx=20, pady=(10, 10), sticky="w")
- fuel_type_l = tk.Label(frame_data, text="Гориво:")
- fuel_type_l.grid(row=4, column=0, padx=20, pady=(10, 10), sticky="w")
- service_l = tk.Label(frame_data, text="Годишен технически преглед (дата):")
- service_l.grid(row=5, column=0, padx=20, pady=(10, 10), sticky="w")
- # TODO -> Entry
- reg_number_e = tk.Entry(frame_data, width=12, justify='right')
- reg_number_e.grid(row=0, column=1, padx=10, pady=10, sticky="w")
- model_e = tk.Entry(frame_data, width=30, justify='center')
- model_e.grid(row=1, column=1, padx=10, pady=10, sticky="w")
- tank_e = tk.Entry(frame_data, width=4, justify='center')
- tank_e.grid(row=2, column=1, padx=10, pady=10, sticky="w")
- fuel_rate_e = tk.Entry(frame_data, width=4, justify='center')
- fuel_rate_e.grid(row=3, column=1, padx=10, pady=10, sticky="w")
- fuel_type_e = tk.Entry(frame_data, width=15, justify='center')
- fuel_type_e.grid(row=4, column=1, padx=10, pady=10, sticky="w")
- service_e = tk.Entry(frame_data, width=15, justify='center')
- service_e.grid(row=5, column=1, padx=10, pady=10, sticky="w")
- # TODO -> Buttons
- save_b = tk.Button(frame_bottom, text="ЗАПИС", fg="blue")
- save_b.grid(row=0, column=0)
- # TODO -> Бутона НОВ да се разреши!
- self.properties.mainloop()
- if __name__ == '__main__':
- start = Main()
- start.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement