tkinter boilerplate

Solutions on MaxInterview for tkinter boilerplate by the best coders in the world

showing results for - "tkinter boilerplate"
Merissa
03 Jan 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()
Christian
07 Jan 2017
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()
Nicola
07 Aug 2016
1import tkinter
2
3window = tkinter.Tk()       # creating the window object
4window.title('my first GUI program')
5# write your code here
6
7window.mainloop()           # keeping the window until we close it