Skip to content

Instantly share code, notes, and snippets.

@tormath1
Created October 21, 2020 07:39
Show Gist options
  • Save tormath1/03358fa33d79a0828e648623278b9781 to your computer and use it in GitHub Desktop.
Save tormath1/03358fa33d79a0828e648623278b9781 to your computer and use it in GitHub Desktop.
simple tkinter frame with inheritance
import tkinter
class Test(tkinter.Frame):
def __init__(self, parent):
tkinter.Frame.__init__(self, parent)
# create entry class attribute
self.entry = tkinter.Entry(self)
self.entry.grid(row=0, column=1)
def set_myvar(self):
self.var = "new hello world"
# main program
root = tkinter.Tk()
frame = Test(root)
frame.pack()
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment