Skip to content
/ PyCal Public

Python and Qt6 Desktop calculator: using MVC design pattern

License

Notifications You must be signed in to change notification settings

phume03/PyCal

Repository files navigation

Python and PyQt6: Building a GUI Desktop Calculator (PyCalc)

PyCalc is a sample calculator implemented using Python 3 and with a PyQt6 GUI. Fundamentally, PyCalc implements basic math operations, such as; division, multiplication, addition, and subtraction.

PyCalc is an example of how to build a Python + PyQt6 GUI application using the Model-View-Controller (MVC) pattern. It was created by following the tutorial and article at RealPython, titled "Python and PyQt: Building a GUI Desktop Calculator".

Folder Content

The current folder, materials-pyqt-calculator/, hosts two subfolders:

  1. docs/ should contain the documentation for pycalc
  2. pycalc/ stores the code and related resources for your PyQt Calculator app.

Screenshot

Screenshot

Requirements

For PyCalc to work, you need to have Python >= 3.6.1. Then you need to install the PyQt6 library. You can do this by using pip in a Python virtual environment:

$ python -m venv devenv
$ source devenv/bin/activate
$ python -m pip install pyqt6

After these commands have finished, you can run PyCalc as described in the next section.

How to Run PyCalc

To run PyCalc from your system's command line or terminal, execute the following command:

$ python pycalc.py

After running this command, you'll get PyCalc running on your machine. If you choose to edit the application for whatever reason, you may also wish to run it in editable mode from your virtual environment, so you can see the changes you have made right away. To do that, run the following command:

(devenv) $ pip install -e .

Run this from the project directory and it will automatically pick pycalc to install in editable mode.

How to Use PyCalc

To use PyCalc, just enter a valid math expression using your mouse and then press Enter or click the = button to get the result.

About the Author

PyCalc is originally developed by Leodanis Pozo Ramos is a self-taught Python Developer, and content creator at Real Python. It is edited by Phumelela Mdluli while learning from or using RealPython to learn.

License

This project is distributed under the GPL license. See LICENSE for more information.

Resources

About

Python and Qt6 Desktop calculator: using MVC design pattern

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages