Python Forum
[Tkinter] how to celect com port from spinbox and make connect button
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] how to celect com port from spinbox and make connect button
hi, I am a novice in programming I am woodworker :D

here is my question: how to select com port from spinbox and make connect button


#!/usr/bin/env python

import tkinter
from tkinter import ttk
import serial
import time  # importuj kniznicu
import  # importuj kniznicu pre skenovanie com portov
import sys

root = tkinter.Tk()

ports =
    include_links=False)  # skenovanie com portov

selected_lang = tkinter.StringVar()

langs = (ports)

spinbox = tkinter.Spinbox(root, values=langs, width=10,
                          textvariable=selected_lang, wrap=True)

Arduino_Serial = serial.Serial("COM7", 9600)

def on():

def off():

showButton = ttk.Button(root, text="turn on led",
showButton1 = ttk.Button(root, text="turn off led",

spinbox.grid(column=1, row=1)
showButton.grid(column=2, row=1)
showButton1.grid(column=2, row=2)


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make button text bold in Tkinter? scratchmyhead 2 2,297 May-16-2020, 02:53 AM
Last Post: scratchmyhead
  [PyQt] Pyqt5: How do you make a button that adds new row with data to a Qtablewidget YoshikageKira 6 2,514 Jan-02-2020, 04:32 PM
Last Post: Denni
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 2,202 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp
  [Tkinter] How make a button perform a function after the user inputs numbers Zephyrforce 1 1,123 May-22-2019, 05:43 PM
Last Post: woooee
  [Tkinter] Make A Button That Opens Another Tk() Window That I Have Made Saif133 5 24,587 Jan-20-2017, 08:10 PM
Last Post: scriptso

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020