How to create a Calculator GUI with Python programming language Source code free . Here I will use the Kivy package in Python to build a Calculator GUI. Kivy is a free, Open Source Python library that enables the rapid and easy development of highly interactive cross-platform applications. Kivy’s execution speed is the same as compared to the other mobile development alternatives like Java for Android and Objective C for iOS.
Kivy offers an excellent balance of performance and portability in various hardware and software environments.

Also, Read -100+ Android Projects Solved and Explained.
Calculator GUI with Python – We don’t need to use any file named as file.kv for building a calculator, as a calculator is a very simple application. Let’s see how to build a simple calculator GUI with Python:
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
class myApp(App):
def build(self):
root_widget = BoxLayout(orientation='vertical')
output_label = Label(size_hint_y = 0.75, font_size=50)
button_symbols = ('1', '2', '3', '+',
'4', '5', '6', '-',
'7', '8', '9', '.',
'0', '*', '/', '=')
button_grid = GridLayout(cols=4, size_hint_y=2)
for symbol in button_symbols:
button_grid.add_widget(Button(text=symbol))
clear_button = Button(text = 'Clear', size_hint_y=None, height=100)
def print_button_text(instance):
output_label.text += instance.text
for button in button_grid.children[1:]:
button.bind(on_press=print_button_text)
def resize_label_text(label, new_height):
label.fontsize = 0.5*label.height
output_label.bind(height=resize_label_text)
def evaluate_result(instance):
try:
output_label.text = str(eval(output_label.text))
except SyntaxError:
output_label.text = 'Python Syntax error!'
button_grid.children[0].bind(on_press=evaluate_result)
def clear_label(instance):
output_label.text = " "
clear_button.bind(on_press=clear_label)
root_widget.add_widget(output_label)
root_widget.add_widget(button_grid)
root_widget.add_widget(clear_button)
return root_widget
myApp().run()
NOTE – In order to run the project of Python, you have to download Python IDLE or Pycharam. In the video I have explained how to download and install it.
Download and Install Python
Download and install Pycharm
TOP 50+ PYTHON PROJECT WITH SOURCE CODE FREE
Additional Reading
- SEO Practices Everyone Should Follow SEO Rules
- Complete Top SEO Checklist
- Yoast Seo Premium 15.2 Nulled – WordPress SEO Plugin
- Top 50+ SEO Interview Questions
- What is a Backlink? How to Get More Backlinks
- TOP 20+ ANDROID PROJECT WITH SOURCE CODE
READ MORE
If you found this post useful, don’t forget to share this with your friends, and if you have any query feel free to comment it in the comment section.
Thank you 🙂 Keep Learning !