Code: Alles auswählen
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Perlchamp'
__date__ = '14.03.2019'
import tkinter as tk
ROOT_TITLE = ' Schriftarten'
FAVICON = 'image/perlchamp_20x16.ico'
ROOT_WIDTH = 350
ROOT_HEIGHT = 300
ROOT_X_POSITION = '+20'
ROOT_Y_POSITION = '+20'
ROOT_BGCOLOR = '#999999'
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master, bg=ROOT_BGCOLOR)
self.__create_widgets()
def __create_widgets(self):
top = self.winfo_toplevel()
top.columnconfigure(0, weight=1)
top.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.quit_button = tk.Button(self, text='Beenden', command=self.quit)
self.quit_button.grid(row=0, column=0)
self.bbox_label = tk.Label(self, text=self.quit_button.grid_bbox())
self.bbox_label.grid(row=1, column=0)
def main():
root = tk.Tk()
root.iconbitmap(FAVICON)
root.title(ROOT_TITLE)
root.geometry(f'{ROOT_WIDTH}x{ROOT_HEIGHT}{ROOT_X_POSITION}{ROOT_Y_POSITION}')
app = Application(root)
app.grid(row=0, column=0, sticky=tk.N +tk.E +tk.S +tk.W)
root.mainloop()
##HAUPTPROGRAMM
if __name__ == '__main__' :
main()