question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ComboBox activated(int) does not get the index argument with PyQt5

See original GitHub issue

I have a python script doig the following:

class MainWindow(QQuickView):
    def __init__(self):
        ...
        self.screen1usageCombo = self.findChild(QtCore.QObject, "combo_screen1_usage")
        self.screen1usageCombo.activated.connect(self.change_screen1_mode)
...
    @asyncSlot()
    async def change_screen1_mode(self, index):
        ...

It works perfectly with Pyside2, but with PyQt5 (both 5.13.2 and 5.14.1) the result is:

Traceback (most recent call last):
  File "/home/yann/.local/lib/python3.7/site-packages/asyncqt/__init__.py", line 644, in wrapper
    asyncio.ensure_future(fn(*args, **kwargs))
TypeError: change_screen1_mode() missing 1 required positional argument: 'index'
Aborted

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ydirsoncommented, Mar 2, 2020

Confirmed on my side as well!

1reaction
syamajalacommented, Feb 21, 2020

I think you have to pass the type to the slot decorator, try this: @asyncSlot(object).

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyQt5 - Setting current index in ComboBox - GeeksforGeeks
Syntax : combo_box.setCurrentIndex(index) ; Argument : It takes integer as argument ; Action performed : It will set item of given index.
Read more >
How to get current value from PyQt comboBox - Stack Overflow
Returns the data for the given role in the given index in the combobox, or QVariant.Invalid if there is no data for this...
Read more >
QComboBox — Qt for Python - Qt Documentation
This property holds the index of the current item in the combobox.. The current index can change when inserting or removing items. By...
Read more >
PyQt Layouts: Create Professional-Looking GUI Applications
In this step-by-step tutorial, you'll learn how to use PyQt layouts to arrange and manage the graphical components on your GUI applications.
Read more >
QComboBox Class Reference
The QComboBox widget is a combined button and popup list. More. ... The parent argument, if not None, causes self to be owned...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found