All Projects → wallysalami → tkgpio

wallysalami / tkgpio

Licence: MIT license
A Python library to simulate electronic devices connected to the GPIO on a Raspberry Pi, using TkInter.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tkgpio

Open-Manager
如何管理杂乱的电脑桌面和一大堆的浏览器收藏网址?我用python写了一个工具,迅速提高工作效率。
Stars: ✭ 41 (-28.07%)
Mutual labels:  tkinter
FotoKilof
GUI for ImageMagick
Stars: ✭ 114 (+100%)
Mutual labels:  tkinter
gophersnake
Stand-alone Gopher client for modern desktops
Stars: ✭ 14 (-75.44%)
Mutual labels:  tkinter
STUDENT-ATTENDANCE-USING-FACIAL-RECOGNITION-SYSTEM-OPENCV
No description or website provided.
Stars: ✭ 46 (-19.3%)
Mutual labels:  tkinter
password-keeper
A simple and secure Password Management System made completely in Python.
Stars: ✭ 26 (-54.39%)
Mutual labels:  tkinter
PT-Tracking
Aplicação para registo e acompanhamento de encomendas da CTT Expresso, automatiza a consulta online do estado de tracking para várias remessas e mantém um registo dos pagamentos referentes aos envios à cobrança. As remessas que requerem atenção, devido a atrasos na entrega ou na receção do pagamento correspondente, bem como os cheques cuja data …
Stars: ✭ 18 (-68.42%)
Mutual labels:  tkinter
tukaan
A modern, cross platform Python toolkit for creating desktop GUI applications. Contributors are welcome!
Stars: ✭ 97 (+70.18%)
Mutual labels:  tkinter
fatx-tools
Data recovery tools for FATX drives (XBOX and XBOX 360).
Stars: ✭ 51 (-10.53%)
Mutual labels:  tkinter
Face recognition based attendance system
A python GUI integrated attendance system using face recognition to take attendance.
Stars: ✭ 70 (+22.81%)
Mutual labels:  tkinter
tkinterhowtos
A software package containing solutions to simple (and possibly recurrent) "how to" problems in tkinter.
Stars: ✭ 18 (-68.42%)
Mutual labels:  tkinter
ib-historical-data
Interactive Brokers TWS API -- Historical data downloader
Stars: ✭ 40 (-29.82%)
Mutual labels:  tkinter
tic-tac-toe-in-python
Socket-based client-server Tic Tac Toe game in Python developed using TkInter GUI toolkit.
Stars: ✭ 29 (-49.12%)
Mutual labels:  tkinter
Tkinter-Designer
An easy and fast way to create a Python GUI 🐍
Stars: ✭ 4,697 (+8140.35%)
Mutual labels:  tkinter
test-case-generator
Test Case generator for competitive coding. Test case generator for competitive programming and potentially for software testing.
Stars: ✭ 28 (-50.88%)
Mutual labels:  tkinter
Barcode-generator
Desktop app to generate EAN-13, EAN-8 and EAN-5 barcodes (other types are coming soon) automatically and save them as PDF or PNG, JPEG and GIF image files with several sizes
Stars: ✭ 48 (-15.79%)
Mutual labels:  tkinter
pyGISS
📡 A lightweight GIS Software in less than 100 lines of code
Stars: ✭ 114 (+100%)
Mutual labels:  tkinter
TeslaPy
A Python module to use the Tesla Motors Owner API
Stars: ✭ 216 (+278.95%)
Mutual labels:  tkinter
programminginpython.com
This repo consists code of all the programs discussed at programminginpython.com website
Stars: ✭ 60 (+5.26%)
Mutual labels:  tkinter
Python-Course
🐍 This is the most complete course in Python, completely practical and all the lessons are explained with examples, so that they can be easily understood. 🍫
Stars: ✭ 18 (-68.42%)
Mutual labels:  tkinter
tkcalendar
Calendar widget for Tkinter
Stars: ✭ 62 (+8.77%)
Mutual labels:  tkinter

tkgpio

A Python library to simulate electronic devices connected to the GPIO on a Raspberry Pi, using TkInter.

About

Due to the Coronavirus outbreak in 2020, students enrolled in my Microcontroller course could not use the laboratory. So I decided to build a Raspberry Pi circuit simulator, to make remote class activities possible. And it works pretty well!

The main goal here is to enable students to use the same APIs that control physical devices connected to the GPIO, but interacting with a GUI instead. I'm not worried about creating a realistic electronic simulation.

Since we were already using Python to program on Raspberry Pi, I've built the interface with TkInter. Some libraries (like gpiozero) allowed me to easily mock the devices in the GUI. In other cases, I had to reimplement the API inside the library – but since I can temporaraly add folders to Python's PATH, import commands keep working exactly as the original ones.

TkGPIO currently supports the following devices:

  • Some gpiozero components (more coming soon)
    • LED / PWMLED
    • (Active) Buzzer
    • DC Motor
    • Servomotor
    • Push Button
    • Toggle Switch
    • Distance Sensor (HC-SR04)
    • Light Sensor (LDR)
    • Motion Sensor (HC-SR501)
    • Potentiometer (via MCP3xxx chip)
  • LCD display (reimplementing Adafruit_CharLCD API)
    • Only message and clear methods are supported for now (more coming soon)
  • Infrared emmitter (reimplementing py_irsend API)
  • Infrared receiver (reimplementing python-lirc API)

TkGPIO also supports labels with text, border and background color.

Usage

This is a simple example to create and control 2 LEDs and 1 Button.

from tkgpio import TkCircuit

# initialize the circuit inside the GUI

configuration = {
    "width": 300,
    "height": 200,
    "leds": [
        {"x": 50, "y": 40, "name": "LED 1", "pin": 21},
        {"x": 100, "y": 40, "name": "LED 2", "pin": 22}
    ],
    "buttons": [
        {"x": 50, "y": 130, "name": "Press to toggle LED 2", "pin": 11},
    ]
}

circuit = TkCircuit(configuration)
@circuit.run
def main ():
    
    # now just write the code you would use on a real Raspberry Pi
    
    from gpiozero import LED, Button
    from time import sleep
    
    led1 = LED(21)
    led1.blink()
    
    def button_pressed():
        print("button pressed!")
        led2.toggle()
    
    led2 = LED(22)
    button = Button(11)
    button.when_pressed = button_pressed
    
    while True:
        sleep(0.1)

You could also initialize the circuit in a function inside a separate Python file, to hide it from students.

Check more sample code files in docs/examples.

Instalation

Use PyPI to install TkGPIO in your computer.

pip install tkgpio
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].