osdir.com


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

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


On Mon, Mar 4, 2019 at 9:34 AM Rich Shepard <rshepard at appl-ecosys.com> wrote:
>
> 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.
>
> Chris,
>
> Yep. And I was not sure just how I would get these unitl I read your
> answer.

Right, right. Just be aware that your subject line implied that it was
a ttk question, while in reality, it was more of an SQLAlchemy
question. So I wanted to clarify that part early in the response.

> > 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,

Awesome! You're most welcome.

Have fun!

ChrisA