Python Simple Calculator Program | TKinter Calculator Program | VCMIT

Python Simple Calculator Program With TKinter Calculator




INPUT

from tkinter import Tk, Label, Button, Entry


class Root(Tk):
    def __init__(self):
        super().__init__()
        self.title_label = Label(self, text="A Simple Calculator :)")
        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()

OUTPUT



Disqus Comments
TheWaoFam. يتم التشغيل بواسطة Blogger.

إجمالي مرات مشاهدة الصفحة

بحث هذه المدونة الإلكترونية

  • ()

Random Posts

randomposts

Recent Posts

recentposts

Footer Link

Connected

Facebook

banner image

Most Recent

نموذج الاتصال

Categories

There are many variations of passages of Lorem Ipsum available.

About Me

Hi there, I’m Amanda – a girl love fashion and love to express herself with her own sense of style.

Trending