Last active
July 14, 2019 07:21
-
-
Save DeflatedPickle/82d8e044aa03b3644ff10353754b8f59 to your computer and use it in GitHub Desktop.
Endlessly generates a random number and shows it in a Tkinter window.
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
import tkinter as tk | |
import random | |
class Random(tk.Tk): | |
def __init__(self): | |
tk.Tk.__init__(self) | |
self.title("Random") | |
self.variable = tk.IntVar() | |
label = tk.Label(self, textvariable=self.variable, font=("courier", 69)) | |
label.pack(fill="both", expand=True) | |
self.do_random() | |
def do_random(self, interval=100): | |
self.variable.set(random.randint(0, 99999)) | |
self.after(interval, self.do_random) | |
def main(): | |
r = Random() | |
r.mainloop() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment