from tkinter import *
class Calc:
	def __init__(self,master):
		self.MathVariable = 0
		self.Value = 0
		self.master = master
 
		self.NumberEntry = Entry(self.master, width=40, borderwidth=5)
		self.NumberEntry.grid(row=0, column=0, padx=10, pady=10, columnspan=5)
		i,j=1,0
		for btn in ['1','2','3','4','5','6','7','8','9','+','-','0','*','/','=']:
			if i%4==0:
				i=1
				j+=1
			Button(self.master,text=btn, width=5,command=lambda num =btn:self.BtnClick(num)).grid(row=i, column=j,ipadx=4)
			i+=1
		self.clear = Button(self.master,text='إمسح', width=15,command=self.Clear).grid(row=5, columnspan=6,ipadx=70)
 
	def BtnClick(self, number):
		if number == '=':
			self.Equal()
		else:
			self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(number))
	def Equal(self):
		value1 = self.NumberEntry.get()
		try:
			value1 = eval(value1)
			new_string = f'{value1: ,}'
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, new_string)
		except ZeroDivisionError:
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
		except SyntaxError:
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, 'Syntax error')
	def Clear(self):
		self.NumberEntry.delete(0, END)
		self.Value = 0
 
if __name__ == "__main__":
	master = Tk()
	master.title('آلة حاسبة')
	master.geometry('272x155')
	master.resizable(0,0)
	Calc(master)
	master.mainloop()

291d4c24305d9f23210e99e8df1b02bc5d746d3d
<mask token>


class Calc:
    <mask token>

    def BtnClick(self, number):
        if number == '=':
            self.Equal()
        else:
            self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(
                number))

    def Equal(self):
        value1 = self.NumberEntry.get()
        try:
            value1 = eval(value1)
            new_string = f'{value1: ,}'
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, new_string)
        except ZeroDivisionError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
        except SyntaxError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'Syntax error')
    <mask token>


<mask token>

<mask token>


class Calc:
    <mask token>

    def BtnClick(self, number):
        if number == '=':
            self.Equal()
        else:
            self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(
                number))

    def Equal(self):
        value1 = self.NumberEntry.get()
        try:
            value1 = eval(value1)
            new_string = f'{value1: ,}'
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, new_string)
        except ZeroDivisionError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
        except SyntaxError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'Syntax error')

    def Clear(self):
        self.NumberEntry.delete(0, END)
        self.Value = 0


<mask token>

<mask token>


class Calc:

    def __init__(self, master):
        self.MathVariable = 0
        self.Value = 0
        self.master = master
        self.NumberEntry = Entry(self.master, width=40, borderwidth=5)
        self.NumberEntry.grid(row=0, column=0, padx=10, pady=10, columnspan=5)
        i, j = 1, 0
        for btn in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-',
            '0', '*', '/', '=']:
            if i % 4 == 0:
                i = 1
                j += 1
            Button(self.master, text=btn, width=5, command=lambda num=btn:
                self.BtnClick(num)).grid(row=i, column=j, ipadx=4)
            i += 1
        self.clear = Button(self.master, text='إمسح', width=15, command=
            self.Clear).grid(row=5, columnspan=6, ipadx=70)

    def BtnClick(self, number):
        if number == '=':
            self.Equal()
        else:
            self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(
                number))

    def Equal(self):
        value1 = self.NumberEntry.get()
        try:
            value1 = eval(value1)
            new_string = f'{value1: ,}'
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, new_string)
        except ZeroDivisionError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
        except SyntaxError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'Syntax error')

    def Clear(self):
        self.NumberEntry.delete(0, END)
        self.Value = 0


<mask token>

from tkinter import *


class Calc:

    def __init__(self, master):
        self.MathVariable = 0
        self.Value = 0
        self.master = master
        self.NumberEntry = Entry(self.master, width=40, borderwidth=5)
        self.NumberEntry.grid(row=0, column=0, padx=10, pady=10, columnspan=5)
        i, j = 1, 0
        for btn in ['1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '-',
            '0', '*', '/', '=']:
            if i % 4 == 0:
                i = 1
                j += 1
            Button(self.master, text=btn, width=5, command=lambda num=btn:
                self.BtnClick(num)).grid(row=i, column=j, ipadx=4)
            i += 1
        self.clear = Button(self.master, text='إمسح', width=15, command=
            self.Clear).grid(row=5, columnspan=6, ipadx=70)

    def BtnClick(self, number):
        if number == '=':
            self.Equal()
        else:
            self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(
                number))

    def Equal(self):
        value1 = self.NumberEntry.get()
        try:
            value1 = eval(value1)
            new_string = f'{value1: ,}'
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, new_string)
        except ZeroDivisionError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
        except SyntaxError:
            self.NumberEntry.delete(0, END)
            self.NumberEntry.insert(0, 'Syntax error')

    def Clear(self):
        self.NumberEntry.delete(0, END)
        self.Value = 0


if __name__ == '__main__':
    master = Tk()
    master.title('آلة حاسبة')
    master.geometry('272x155')
    master.resizable(0, 0)
    Calc(master)
    master.mainloop()

from tkinter import *
class Calc:
	def __init__(self,master):
		self.MathVariable = 0
		self.Value = 0
		self.master = master
 
		self.NumberEntry = Entry(self.master, width=40, borderwidth=5)
		self.NumberEntry.grid(row=0, column=0, padx=10, pady=10, columnspan=5)
		i,j=1,0
		for btn in ['1','2','3','4','5','6','7','8','9','+','-','0','*','/','=']:
			if i%4==0:
				i=1
				j+=1
			Button(self.master,text=btn, width=5,command=lambda num =btn:self.BtnClick(num)).grid(row=i, column=j,ipadx=4)
			i+=1
		self.clear = Button(self.master,text='إمسح', width=15,command=self.Clear).grid(row=5, columnspan=6,ipadx=70)
 
	def BtnClick(self, number):
		if number == '=':
			self.Equal()
		else:
			self.NumberEntry.insert(len(self.NumberEntry.get()) + 1, str(number))
	def Equal(self):
		value1 = self.NumberEntry.get()
		try:
			value1 = eval(value1)
			new_string = f'{value1: ,}'
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, new_string)
		except ZeroDivisionError:
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, 'لا يمكن القسمة على الصفر')
		except SyntaxError:
			self.NumberEntry.delete(0, END)
			self.NumberEntry.insert(0, 'Syntax error')
	def Clear(self):
		self.NumberEntry.delete(0, END)
		self.Value = 0
 
if __name__ == "__main__":
	master = Tk()
	master.title('آلة حاسبة')
	master.geometry('272x155')
	master.resizable(0,0)
	Calc(master)
	master.mainloop()
