aboutsummaryrefslogtreecommitdiff
path: root/ctec/__main__.py
blob: eff613896e0da1366d2b931fa019c56b172e48a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from tkinter import *
from tkinter import messagebox
from tkinter import ttk

from . import VERSION

class CtecFrame:
    def __init__(self, root: Tk):
        self.root = root
        root.title('ctec')

        mainframe = ttk.Frame(root, padding="3 3 12 12")
        mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        root.columnconfigure(0, weight=1)
        root.rowconfigure(0, weight=1)

        # create a menu bar
        self.make_menu_bar(root)

    def make_menu_bar(self, root):
        root.option_add('*tearOff', FALSE)

        menubar = Menu(root)
        root['menu'] = menubar

        file_menu = Menu(menubar)
        menubar.add_cascade(menu=file_menu, label='File', underline=0)
        file_menu.add_command(label='Exit', command=self.on_exit, underline=1)

        help_menu = Menu(menubar)
        menubar.add_cascade(menu=help_menu, label='Help', underline=0)
        help_menu.add_command(label='About', command=self.on_about, underline=0)

    def on_exit(self, *args):
        self.root.destroy()

    def on_about(self, *args):
        messagebox.showinfo(message=f"ctec {'.'.join(str(x) for x in VERSION)}")


def main():
    root = Tk()
    frame = CtecFrame(root)
    root.mainloop()


main()