Python GUI for generating truth tables using SymPy, saves output to CSV
This Python project generates truth tables for user-defined logic expressions using a simple GUI built with tkinter and the sympy library.
- Accepts any user-defined logical expression (e.g.,
A & B | ~C,A ^ B, etc.) - Lets the user specify the number of input variables.
- Automatically generates the complete truth table.
- Easy-to-use Graphical Interface (GUI).
- Supports standard logic gates like:
- AND (
&) - OR (
|) - NOT (
~) - XOR (
^) - NAND (
~(A & B)) - NOR (
~(A | B)) - XNOR (
~(A ^ B))
- AND (
- Enter the number of input variables (e.g., 2 or 3).
- Enter a logical expression (e.g.,
A & ~B | C). - Click "Generate Truth Table" to view the output.
The backend uses the Sympy library for parsing and evaluating Boolean expressions symbolically, ensuring high accuracy even for complex logic circuits.
- Language: Python 3.x
- Libraries Used:
tkinter(GUI)sympy(logic evaluation)itertools(truth table generation)
- Clone this repository:
git clone https://github.com/sukanyap1/Logic_Truth_Table_Generator.git
- Navigate to the folder:
cd Logic_Truth_Table_Generator
- Install dependencies:
pip install sympy
- Run the program:
python logic_gui.py