We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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="enter", command=self.onclick) self.button.pack()
def onclick(self): self.label.configure(text=str(eval(self.entry.get())))
root = Root() root.mainloop()
![Image](https://github.com/petermb9/my-turtle-python/assets/69215418/069cb864-6eaf-47cf-b53d-a18c429507d9
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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="enter", command=self.onclick)
self.button.pack()
root = Root()
root.mainloop()
![Image](https://github.com/petermb9/my-turtle-python/assets/69215418/069cb864-6eaf-47cf-b53d-a18c429507d9
The text was updated successfully, but these errors were encountered: