Sunday, November 25, 2018

Calculator (graphic user interface)

  • PYTHON PROGRAMING LANGUAGE(GUI CALCULATOR WITH TKINTER)

Output:  

from tkinter import *

def btnclick(number):
    global operator
    operator = operator + str(number)
    text_input.set(operator)


def btnclear():
    global operator
    operator=""
    text_input.set("")

def btnenter():
    global operator
    sumup = str(eval(operator))
    text_input.set(sumup)
    operator=""



def btnstart(number):
    text_input.set(number)
    print(number)


cal = Tk()
cal.title("Color full calculator with cleveraadi")
cal.geometry("340x490")
cal.minsize(340,490)
cal.maxsize(340,490)

operator= ""
text_input = StringVar()

#display for input.,
text_display= Entry(cal,textvariable=text_input,insertwidth=5,
                    font="comicsansms 20 bold",justify="right",bd=18,bg="blue")
text_display.grid(columnspan=4)


#buttons.



b7=Button(cal,text="7",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(7))
b7.grid(row=1,column=0)

b8=Button(cal,text="8",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(8))
b8.grid(row=1,column=1)

b9=Button(cal,text="9",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(9))
b9.grid(row=1,column=2)

start=Button(cal,text="Start",font="comicsansms 10 bold",bd=8,padx=20,pady=26,fg="green",
                                                                         command=lambda :btnstart(0))

start.grid(row=1,column=3)

#row=second now start........

b4=Button(cal,text="4",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(4))
b4.grid(row=2,column=0)

b5=Button(cal,text="5",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(5))
b5.grid(row=2,column=1)

b6=Button(cal,text="6",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(6))
b6.grid(row=2,column=2)

addition=Button(cal,text="+",font="comicsansms 10 bold",bd=8,padx=28,pady=28,fg="green",
             command=lambda :btnclick("+"))
addition.grid(row=2,column=3)

# third rows.

b3=Button(cal,text="3",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(9))
b3.grid(row=3,column=0)

b2=Button(cal,text="2",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(2))
b2.grid(row=3,column=1)

b1=Button(cal,text="1",font="comicsansms 15 bold",padx=20,pady=20,bd=8,fg="green",
          command=lambda: btnclick(1))
b1.grid(row=3,column=2)

enter=Button(cal,text="Enter",font="comicsansms 10 bold",bd=8,padx=15,pady=28,fg="green",
             command=lambda :btnenter())
enter.grid(row=3,column=3)


#4th row's......

zero=Button(cal,text="0",font="comicsansms 15 bold",bd=8,padx=20,pady=20,fg="green",
             command=lambda:btnclick(0))
zero.grid(row=4,column=0)

btndiv=Button(cal,text="/",font="comicsansms 15 bold",bd=8,padx=20,pady=20,fg="green",
             command=lambda :btnclick('/'))
btndiv.grid(row=4,column=1)

btnmul=Button(cal,text="*",font="comicsansms 15 bold",bd=8,padx=22,pady=20,fg="green",
             command=lambda :btnclick('*'))
btnmul.grid(row=4,column=2)

btnsub=Button(cal,text="--",font="comicsansms 15 bold",bd=8,padx=22,pady=20,fg="green",
             command=lambda :btnclick('-'))
btnsub.grid(row=4,column=3)

#clear clear
clear=Button(cal,text="Clear && Double click Exit",padx=145,pady=8,bd=4,font="cominsansms 10 bold",fg="green",
             command = lambda:btnclear())
clear.place(x=1,y=445)
clear.bind('<Double-1>',quit)




cal.mainloop()































Arrays in Solidity Programming Language.

Arrays Solidity supports both generic and byte arrays. It supports both fixed size and dynamic arrays. It also supports multidimensional ...