Skip to content

petermb9/Python-Tkinter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Python-Tkinter

from tkinter import Tk, Label, Button, Entry

class Root(Tk):

def __init__(self):
    super().__init__()
    self.title_label = Label(self, text="A simple eval-based calculator, \nnot for production usage :)")
    self.title_label.pack()
    self.entry = Entry(self)
    self.entry.pack()
    self.entry.insert(0, "1+2")
    self.label = Label(self, text="")
    self.label.pack()
    self.button = Button(self, text="Compute", command=self.onclick)
    self.button.pack()

def onclick(self):
    self.label.configure(text=str(eval(self.entry.get())))

root = Root() root.mainloop()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published