Python Forum
need help with combobox Python 2.7
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help with combobox Python 2.7
#2
Haven't used Qt for some time, but have used several other packages,
and they're all basically the same.

First, check Qt documentation to see if they have a load from file method already built in.

If not, You need to load the combo box manually, which isn't very difficult.

Opening and reading the file would be the same as for any other purpose.
when you isolate the data that you want to populate the combo box with, you will need to find a Qt command
to insert text into the combo box, and do that line by line as you read the data from the file.
See: http://doc.qt.io/qt-5/qcombobox.html find index and insert

You will then also have to bind clicks from the combobox to an event method.
In wxpython and tkinter, this is literally a bind instruction, and probably on Qt as well.
In the routine that you bind to, you will need to extract the index of the item in the combo box,
then get the item at that index, and use it to reference back to your main data source.

Since I don't know the specific commands in Qt, you will have to look them up.
The insert statement should be a method attached to the ComboBox widget, and found in the
documentation for that.

Bind is a bit more general, and probably has it's own documentation.
The syntax is usually the same for buttons, combobox, and many other widgets,
and will have the form of widget.bind(<event type>, methodToexecute)
see: http://doc.qt.io/archives/qt-4.8/eventsandfilters.html

You should be able to use this as a guide to help find associated docs.
Reply


Messages In This Thread
need help with combobox Python 2.7 - by ZipSnipe - Feb-04-2018, 06:24 AM
RE: need help with combobox Python 2.7 - by Larz60+ - Feb-04-2018, 11:46 AM
RE: need help with combobox Python 2.7 - by Larz60+ - Feb-04-2018, 05:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] How can I sync Combobox index to other combobox index? nickzsche 2 2,445 Jan-03-2022, 12:29 PM
Last Post: Axel_Erfurt
  [PyQt] Control a combobox from another python file PyQt5 prath 0 2,319 May-05-2020, 03:22 PM
Last Post: prath
  [python] [Tkinter] Problem bidding combobox with np.array NEL 3 3,466 Aug-04-2019, 11:07 AM
Last Post: Yoriz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020