37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
|
import tkinter.ttk
|
||
|
from tkinter.constants import *
|
||
|
|
||
|
class Application(tkinter.ttk.Frame):
|
||
|
|
||
|
@classmethod
|
||
|
def main(cls):
|
||
|
tkinter.NoDefaultRoot()
|
||
|
root = tkinter.Tk()
|
||
|
app = cls(root)
|
||
|
app.grid(sticky=NSEW)
|
||
|
root.grid_columnconfigure(0, weight=1)
|
||
|
root.grid_rowconfigure(0, weight=1)
|
||
|
root.resizable(True, True)
|
||
|
root.mainloop()
|
||
|
|
||
|
def __init__(self, root):
|
||
|
super().__init__(root)
|
||
|
self.create_widgets()
|
||
|
self.grid_widgets()
|
||
|
self.grid_columnconfigure(0, weight=1)
|
||
|
|
||
|
def create_widgets(self):
|
||
|
self.set_timer = tkinter.ttk.Entry(self, text="Dummy")
|
||
|
self.start = tkinter.ttk.Button(self, text='Start')
|
||
|
self.display1 = tkinter.ttk.Label(self, text='Dummy')
|
||
|
self.display2 = tkinter.ttk.Label(self, text='Dummy')
|
||
|
|
||
|
def grid_widgets(self):
|
||
|
options = dict(sticky=NSEW, padx=3, pady=4)
|
||
|
self.set_timer.grid(column=0, row=0, **options)
|
||
|
self.start.grid(column=0, row=1, **options)
|
||
|
self.display1.grid(column=0, row=2, **options)
|
||
|
self.display2.grid(column=0, row=3, **options)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
Application.main()
|