'How to get the result from 2 combo boxes in python
mdr_type = devices list , mdr_speed = 4 list 1 for each device , dips = list of what i need to set in the device .
example: user select from list 1 item 1 user select from list 2 item 1 result = first item in dips list user select from list 1 item 5 user select from list 2 item 5 result = item number (5) in dips list need help with the result its self how to get the result .
from tkinter import *
import tkinter
from tkinter import ttk
root = tkinter.Tk()
import ctypes
root.geometry('500x800')
ctypes.windll.shcore.SetProcessDpiAwareness(1)
mdr_type = ["MDR_BLACK_BAND","MDR_FULL_GREEN","MDR_STRIP_3BLUE","MDR_CURVE"]
mdr_speed = [["0" , "66","76","85","91","101","107","116","126","132","148","157","164","173","183","198"],
["0","72","81","90","98","105","112","120","127","136","151","163","165","175","185","201"],
["0","80","87","95","102","113","119","130","140","146","163","175","179","190","202","218"],
["0","87","100","114","122","134","143","154","165","175","195","205","213","227","236","264"]]
dips = ["0000","0001","0010","0011","0110","0100""0101","0111","1000","1001","1010","1011","1100","1101","1110","1111"]
type_brand = ttk.Combobox(root, width=37, value=(mdr_type))
type_brand.grid(row=3, column=1, columnspan=2, padx=10, pady=2, sticky='w')
def Dip_switches(eventObject):
abc = eventObject.widget.get()
set = type_brand.get()
index=mdr_type.index(set)
lbl = Label(root, text=Dip_switches, fg='red').place(x=50, y=80)
type_speed = ttk.Combobox(root, width=37)
type_speed.grid(row=4, column=1, columnspan=2, padx=10, pady=2, sticky='w')
type_speed.bind('<Button-1>', Dip_switches)
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|