Last active
June 12, 2022 16:23
-
-
Save Samet195/a953aa01d652bdeb9296d82fc80ff781 to your computer and use it in GitHub Desktop.
Python TkInter Object Oriented Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding:UTF-8 -*- | |
""" | |
TODO: Documentation to here. | |
""" | |
from tkinter import * | |
from ui import Ui | |
import json, sys, os | |
class Window: | |
def __init__(self, root, argv): | |
self.root = root | |
self.argv = argv | |
self.gui = GUI(root, self) | |
self.root.mainloop() | |
def onclick(self): | |
self.gui.button.config(text="OK") | |
if __name__ == "__main__": | |
Window(Tk(), sys.argv[1:]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
class Ui: | |
def __init__(self, root, meta_self): | |
self.button = Button( | |
master=root, | |
text="Press", | |
command=lambda: meta_self.onclick() | |
) | |
self.button.pack(expand=True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment