Skip to content

Instantly share code, notes, and snippets.

@cjerrington
Created March 24, 2020 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjerrington/4aec633567d4126b879e32092803811d to your computer and use it in GitHub Desktop.
Save cjerrington/4aec633567d4126b879e32092803811d to your computer and use it in GitHub Desktop.
# Simple app start when "password" is correct
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
val = input("enter name: ")
if val == "name":
print("true")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
else:
print("Value does not equal name")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment