Skip to content

Instantly share code, notes, and snippets.

@fcaylus
Created October 23, 2016 12:16
Show Gist options
  • Save fcaylus/9a5ca5aa974cef47f62b2a3f2f036f5b to your computer and use it in GitHub Desktop.
Save fcaylus/9a5ca5aa974cef47f62b2a3f2f036f5b to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import tkinter as tk
import threading
class App(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.start()
def requestQuit(self):
self.root.quit()
def run(self):
self.root = tk.Tk()
self.root.protocol("WM_DELETE_WINDOW", self.requestQuit)
label = tk.Label(self.root, text="Hello World")
label.pack()
self.root.mainloop()
app = App()
print('Now we can continue running code while mainloop runs!')
for i in range(100):
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment