tkinter boiler plate

Solutions on MaxInterview for tkinter boiler plate by the best coders in the world

showing results for - "tkinter boiler plate"
Paulina
27 Jul 2016
1# A simple tkinter window
2import tkinter as tk
3from tkinter import ttk
4
5# -- Windows only configuration --
6try:
7    from ctypes import windll
8    windll.shcore.SetProcessDpiAwareness(1)
9except:
10    pass
11# -- End Windows only configuration --
12
13
14root = tk.Tk()
15root.geometry("640x200")
16root.title("Title Here")
17
18label = ttk.Label(root, padding=10, text="Tkinter Window")
19label.config(font=("Comic Sans MS",40))
20label.pack()
21
22root.mainloop()
Leni
10 Oct 2018
1# A simple object oriented tkinter window
2import tkinter as tk
3from tkinter import ttk
4 
5# -- Windows only configuration --
6try:
7    from ctypes import windll
8    windll.shcore.SetProcessDpiAwareness(1)
9except:
10    pass
11    
12    
13class HelloWorld(tk.Tk):
14    def __init__(self):
15        super().__init__()
16
17        self.geometry("640x200")
18        self.title("Title Here")
19
20        label = ttk.Label(self, text="Tkinet window")
21        label.config(font=("Comic Sans MS",40))
22        label.pack()
23
24root = HelloWorld()
25 
26root.mainloop()