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

tkinter: get ttk.combobox choices from another class [RESOLVED]

On Mon, 4 Mar 2019, Chris Angelico wrote:

> Specifically, from my reading of your example, you need a list of
> strings for the applicable values.


Yep. And I was not sure just how I would get these unitl I read your

> So you need to get a list of strings from SQLAlchemy. It's been a while
> since I did that sort of thing, but you should be able to mess with this
> independently of the ComboBox. I don't remember if you can specifically
> ask for all the values for ind_name, but worst case, you should be able to
> do this:
> names = [ind.ind_name for ind in session.query(Industries)]
> Then you can use that list in the ComboBox, once you've tested it.

I've not before used SA, but it makes sense to run a query that returns
all rows in the industries table, assigns those to a list which is passed to
the combobox. I'll work out how exactly to implement this.

Now that you've pointed it out to me it is quite obvious. :-)

Thanks very much,