In this tutorial we will get our tkinter window running and define our 2 classes
Python:
import tkinter as tk
from decimal import Decimal
class Window:
def __init__(self, parent):
self.parent = parent
''' We will be using the grid manager '''
parent.columnconfigure(0, weight=1)
parent.rowconfigure(0, weight=1)
# Set a minimum size for our window
parent.geometry('800x600+200+200')
parent.resizable(False, False)
class Controller:
''' The Controller class will hand all button commands as well as calculations '''
def __init__(self, window):
self.window = window
if __name__ == '__main__':
root = tk.Tk()
root.title('Tkinter Calculator')
controller = Controller(Window(root))
root.mainloop()