osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tkinter: get ttk.combobox choices from another class


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