# From: https://www.pythontutorial.net/tkinter/tkinter-object-oriented-window/ import tkinter as tk from tkinter import ttk from tkinter.messagebox import showinfo class App(tk.Tk): def __init__(self): super().__init__() self.title('test') self.geometry('300x50') self.resizable(0,0) self.columnconfigure(0, weight=1) self.columnconfigure(1, weight=1) self.columnconfigure(2, weight=1) self.columnconfigure(3, weight=1) self.label = ttk.Label(self, text='testing label') self.label.grid(column=1, row=0, columnspan=2, sticky='nsew') self.button = ttk.Button(self, text='testing button') self.button['command'] = self.button_clicked self.button.grid(column=1, row=1, columnspan=2, sticky='nsew') def button_clicked(self): showinfo(title='Information', message='testing button method') if __name__ == "__main__": app = App() app.mainloop()