Python Forum
ComboBox example? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: ComboBox example? (/thread-15187.html)



ComboBox example? - JP_ROMANO - Jan-07-2019

Hi all - I have to rebuild a little utility I created because my source code was wiped out, and I cannot extract the original script from the .exe I converted it to. The original tool was built using tkinter for the GUI, but I really never liked it, so I wanted to try something else.

After a little reading, I decided to try PYFORMS, but I can't seem to get my hands on a basic example of a form with a populated combo box.

Would any of you have an example of something like that? Something super simple, like a small form with a combo box or two, with any values at all.

Thanks for any guidance.


RE: ComboBox example? - nilamo - Jan-07-2019

I don't know pyforms, so I don't know if this fits with the "flow" of how it works, but I cobbled this together using the "base app" and the docs for the combo control (https://pyforms-gui.readthedocs.io/en/v4/api-reference/controls.html#controlcombo), and it seems to work:
from pyforms.basewidget import BaseWidget
from pyforms.controls import ControlCombo

class ComboTest(BaseWidget):
    def __init__(self, *args, **kwargs):
        super().__init__('Combo Box example')

        self._combo = ControlCombo()
        items = ["first", "second"]
        for item in items:
            self._combo.add_item(item)

if __name__ == '__main__':
    from pyforms import start_app
    start_app(ComboTest)



RE: ComboBox example? - JP_ROMANO - Jan-07-2019

It does indeed, thank you so much


RE: ComboBox example? - JP_ROMANO - Jan-07-2019

Nilamo (or anybody else kind enough to get this far) - since I'm just getting started, and am HORRIBLE at python, do you think PySimpleGUI would be a better approach? I'm wide open to suggestions.

The GUI will basically be 10-12 rows, where each row will have:
A) Text Entry
B) Text Entry 2
C) Combo Box 1
D) Combo Box 2
E) Text Entry 3

All 10-12 ComboBox 1's will have the same options. All 10-12 Combobox 2's will have the same options, which differ from combobox 1


RE: ComboBox example? - nilamo - Jan-07-2019

I normally work with websites, and not guis, so I can't really say. But I do know that there are a few people here who really like PyQT.