{"id":18744989,"url":"https://github.com/rkstudio585/factorial-calculator-gui","last_synced_at":"2025-11-22T19:30:17.132Z","repository":{"id":256885406,"uuid":"853130961","full_name":"rkstudio585/Factorial-Calculator-GUI","owner":"rkstudio585","description":"The Factorial Calculator is a Python-based GUI application that computes the factorial of any non-negative integer using recursion. Built with PySide6 and QtPy, it offers a user-friendly interface, error handling, and allows multiple calculations. Perfect for learning recursion and basic Python GUI development.","archived":false,"fork":false,"pushed_at":"2024-09-06T04:18:47.000Z","size":64,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-28T20:14:15.138Z","etag":null,"topics":["calculator","calculator-python","factorial","factorial-calculator","gui","pyqt","pyside6","python"],"latest_commit_sha":null,"homepage":"https://github.com/mdriyadkhan585","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rkstudio585.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T03:47:30.000Z","updated_at":"2024-09-06T04:18:50.000Z","dependencies_parsed_at":"2024-09-13T16:23:09.682Z","dependency_job_id":null,"html_url":"https://github.com/rkstudio585/Factorial-Calculator-GUI","commit_stats":null,"previous_names":["rkstudio585/factorial-calculator-gui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkstudio585%2FFactorial-Calculator-GUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkstudio585%2FFactorial-Calculator-GUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkstudio585%2FFactorial-Calculator-GUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkstudio585%2FFactorial-Calculator-GUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkstudio585","download_url":"https://codeload.github.com/rkstudio585/Factorial-Calculator-GUI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239627247,"owners_count":19670844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculator","calculator-python","factorial","factorial-calculator","gui","pyqt","pyside6","python"],"created_at":"2024-11-07T16:16:30.275Z","updated_at":"2025-11-22T19:30:17.093Z","avatar_url":"https://github.com/rkstudio585.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 Factorial Calculator - GUI Version using PySide6 \u0026 QtPy\n---\n[In python](https://github.com/mdriyadkhan585/Factorial-Calculator-in-Python)\n\n[In C script](https://github.com/mdriyadkhan585/Factorial-Calculator-in-C)\n\n\n![Logo](logo.svg)\n\n---\nWelcome to the **Factorial Calculator**! This is a simple GUI application built using **PySide6** and **QtPy** to calculate the factorial of any non-negative integer. It's easy to use, visually appealing, and perfect for those who want to explore recursion, factorials, and GUI development.\n\n## ✨ Features\n- 🧮 **Recursively computes factorials** for any non-negative integer.\n- ❌ Handles invalid inputs, such as negative numbers or non-integer values, with error messages.\n- 🎨 Clean and simple **graphical user interface** with white text on black background for input fields.\n- 🔁 Supports multiple calculations without needing to restart the app.\n\n## 💡 What is a Factorial?\nThe **factorial** of a non-negative integer `n` is the product of all positive integers less than or equal to `n`. It is denoted as `n!`. For example:\n- `5! = 5 × 4 × 3 × 2 × 1 = 120`\n- Special cases: `0! = 1` and `1! = 1`.\n\n## 🖥️ Project Overview\nThis project is a graphical implementation of a factorial calculator that accepts user input through a text box, computes the factorial, and displays the result in the interface. Error messages are shown when invalid inputs (negative numbers or non-integers) are entered.\n\n## 🎯 How to Use\n\n### 1. Requirements:\n- **Python 3.x** installed on your system.\n- The following Python packages:\n  ```bash\n  pip install PySide6 qtpy\n  ```\n\n### 2. Running the Program:\n1. **Clone or Download** this repository.\n2. Open a terminal or command prompt and navigate to the directory where the code is saved.\n3. Run the Python script with:\n   ```bash\n   git clone https://github.com/mdriyadkhan585/Factorial-Calculator-GUI\n   cd Factorial-Calculator-GUI\n   python factorial_calculator_gui.py\n   ```\n\n4. The graphical user interface (GUI) will appear, where you can enter a number and calculate its factorial.\n\n### 3. Example Input and Output:\n#### Valid Input:\n- **Input**: `5`\n- **Output**: `Factorial of 5 is: 120`\n  \n#### Invalid Input (Negative Number):\n- **Input**: `-5`\n- **Output**: `Error: Factorial of a negative number doesn't exist.`\n  \n#### Invalid Input (Non-integer):\n- **Input**: `abc`\n- **Output**: `Error: Please enter a valid integer.`\n\n## 🛠️ Code Overview\n\n### Main Components:\n- **`QLineEdit` (Input Field)**: A text box where users can enter the number.\n- **`QPushButton` (Button)**: Triggers the calculation of the factorial.\n- **`QLabel` (Labels)**: Displays the result or error messages.\n  \n### Key Functionality:\n- **Factorial Calculation**: The factorial is computed using a recursive function in Python. \n- **Input Validation**: Ensures that the user input is a valid, non-negative integer. Appropriate error messages are shown for invalid inputs.\n- **GUI Layout**: The layout is managed using `QVBoxLayout`, which stacks the widgets vertically for a clean, user-friendly interface.\n\n### Code Breakdown:\n\n- **Factorial Calculation Function**:\n  ```python\n  def factorial(self, n):\n      if n == 0 or n == 1:\n          return 1\n      else:\n          return n * self.factorial(n - 1)\n  ```\n\n- **Input Validation and Error Handling**:\n  The program checks if the input is a valid integer. If the input is not valid or is a negative number, it displays an appropriate error message:\n  ```python\n  def calculate_factorial(self):\n      try:\n          num = int(self.input_field.text())\n          if num \u003c 0:\n              self.result_label.setText('Error: Factorial of a negative number doesn\\'t exist.')\n          else:\n              result = self.factorial(num)\n              self.result_label.setText(f'Factorial of {num} is: {result}')\n      except ValueError:\n          self.result_label.setText('Error: Please enter a valid integer.')\n  ```\n\n- **Input Box Style**:\n  The text color of the input box has been customized to make it visually appealing:\n  ```python\n  self.input_field.setStyleSheet(\"color: white; background-color: black;\")\n  ```\n---\n## Screenshot\n![Screenshot](example.jpg)\n\n---\n## 📂 File Structure\n\n```\nFactorial-Calculator-GUI/\n│\n├── factorial_calculator_gui.py   # Main Python file containing the GUI code\n└── README.md                     # This README file\n```\n\n## 🧑‍💻 Contributing\nIf you'd like to contribute or improve this project, feel free to open an issue or submit a pull request. Suggestions and feedback are always welcome!\n\n## 📜 License\nThis project is licensed under the **MIT License**. See the `LICENSE` file for more information.\n\n## 🎉 Acknowledgements\n- Thanks to the **PySide6** and **QtPy** libraries for making Python GUI development easier!\n- Python community for continuous support and improvement in the language and libraries.\n\n---\n\n### 🎯 Summary\nThis **Factorial Calculator** is a fun and interactive way to compute factorials using a simple yet elegant GUI. Whether you're learning Python or just need a tool to quickly calculate factorials, this project has got you covered. Enjoy coding! 😊\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkstudio585%2Ffactorial-calculator-gui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkstudio585%2Ffactorial-calculator-gui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkstudio585%2Ffactorial-calculator-gui/lists"}