tkinter: get ttk.combobox choices from another class

Rich Shepard rshepard at appl-ecosys.com
Sun Mar 3 16:44:36 EST 2019


I'm using Alan D. Moore's tkinter book as a template for my application.

In the views module in his book the one form has a ttk.Combobox and lists
the available values in an input_args dictionary. To allow addition of new
choices for this column in my application they are in a separate class.
Example from my code:

in my application's views module this data entry form class includes,
self.inputs['Industry'] = LabelInput(
             OrgDataForm, "industry",
             input_class=ValidatedCombobox,
             input_var=tk.StringVar(),
             input_args={"values": ["", "", "", ""]}
         )
         self.inputs['Industry'].grid(row=0, column=1)


The middleware/controller is SQLAlchemy (postgres back end). The model.py
contains,
class Industries(Base):
     __tablename__ = 'industries'

     ind_name = Column(String, primary_key=True)

How can I have the ttk.Combobox get the values from the Industries class?

(If I confused you let me know and I'll try to clarify the situation.)

TIA,

Rich



More information about the Python-list mailing list