Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Serial Port Tracker for Windows
Author | Message | ||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
There are times when I want to know which serial ports are active on my windows PC. While I *could* fire up TeraTerm to see the list... I sort of wanted to have a little window where I could see active ports. Result: This super-simple python script... I figured I would just share it. #------------------------------------------------------------------------------- # Name: SerialTracker.py # Purpose: Simple tracker for active serial ports attached to windows PC # # Author: Pete Willard # # Created: 15/08/2023 # Copyright: (c) willard 2023 # Licence: CC BY-NC-SA #------------------------------------------------------------------------------- import serial.tools.list_ports import time import PySimpleGUI as sg def main(): layout = [ [sg.Text("Available Serial Ports:")], [sg.Listbox(values=[], size=(40, 10), key="-PORTS-")], [sg.Button("Exit")] ] window = sg.Window("Port Tracker", layout) while True: event, values = window.read(timeout=1000) # Auto-update every 1000 milliseconds if event == sg.WINDOW_CLOSED or event == "Exit": break refresh_ports(window) window.close() def refresh_ports(window): ports = [port.device for port in serial.tools.list_ports.comports()] window["-PORTS-"].update(values=ports) if __name__ == "__main__": main() github |
||||
DaveJacko Regular Member Joined: 25/07/2019 Location: United KingdomPosts: 76 |
I'm a purist.. could this be done with MMBasic for DOS ? Thanks Pete, personally think MMBasic could run the world. |
||||
Chopperp Guru Joined: 03/01/2018 Location: AustraliaPosts: 1057 |
TassyJim's MMCC also gives a good indication of ports added or removed but that would need firing up as well. I also use this Windows one here Brian Edited 2023-08-16 09:58 by Chopperp ChopperP |
||||
Print this page |