Answers for "tkinter boilerplate"

1

tkinter boiler plate

# A simple object oriented tkinter window
import tkinter as tk
from tkinter import ttk
 
# -- Windows only configuration --
try:
    from ctypes import windll
    windll.shcore.SetProcessDpiAwareness(1)
except:
    pass
    
    
class HelloWorld(tk.Tk):
    def __init__(self):
        super().__init__()

        self.geometry("640x200")
        self.title("Title Here")

        label = ttk.Label(self, text="Tkinet window")
        label.config(font=("Comic Sans MS",40))
        label.pack()

root = HelloWorld()
 
root.mainloop()
Posted by: Guest on July-09-2020
1

tkinter boiler plate

# A simple tkinter window
import tkinter as tk
from tkinter import ttk

# -- Windows only configuration --
try:
    from ctypes import windll
    windll.shcore.SetProcessDpiAwareness(1)
except:
    pass
# -- End Windows only configuration --


root = tk.Tk()
root.geometry("640x200")
root.title("Title Here")

label = ttk.Label(root, padding=10, text="Tkinter Window")
label.config(font=("Comic Sans MS",40))
label.pack()

root.mainloop()
Posted by: Guest on July-09-2020
1

tkinter boilerplate

import tkinter

window = tkinter.Tk()       # creating the window object
window.title('my first GUI program')
# write your code here

window.mainloop()           # keeping the window until we close it
Posted by: Guest on February-01-2021

Python Answers by Framework

Browse Popular Code Answers by Language