Skip to main content

Python Simple Calculator Program | TKinter Calculator Program | WaoFamHub

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



Comments

Popular posts from this blog

Bresenham’s Line Drawing Algorithm Program In C | WaoFamHub

Bresenham’s Line Drawing Algorithm Program In C INPUT #include<stdio.h> #include<graphics.h> void drawline(int x0, int y0, int x1, int y1) { int dx, dy, p, x, y; dx=x1-x0; dy=y1-y0; x=x0; y=y0; p=2*dy-dx; while(x<x1) { if(p>=0) { putpixel(x,y,7); y=y+1; p=p+2*dy-2*dx; } else { putpixel(x,y,7); p=p+2*dy; } x=x+1; } } int main() { int gdriver=DETECT, gmode, error, x0, y0, x1, y1; initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi"); printf("Enter co-ordinates of first point: "); scanf("%d%d", &x0, &y0); printf("Enter co-ordinates of second point: "); scanf("%d%d", &x1, &y1); drawline(x0, y0, x1, y1); getch(); } OUTPUT

Python TKinter Text Editor Program | TKinter | WaoFamHub

Python TKinter Text Editor Program INPUT from tkinter import * from tkinter.filedialog import * from tkinter.messagebox import * from tkinter.font import Font from tkinter.scrolledtext import * import file_menu import edit_menu import format_menu import help_menu root = Tk() root.title("Text Editor-Untiltled") root.geometry("300x250+300+300") root.minsize(width=400, height=400) text = ScrolledText(root, state='normal', height=400, width=400, wrap='word', pady=2, padx=3, undo=True) text.pack(fill=Y, expand=1) text.focus_set() menubar = Menu(root) file_menu.main(root, text, menubar) edit_menu.main(root, text, menubar) format_menu.main(root, text, menubar) help_menu.main(root, text, menubar) root.mainloop() OUTPUT