Skip to content

Commit

Permalink
--amend
Browse files Browse the repository at this point in the history
  • Loading branch information
almarklein committed Oct 4, 2024
1 parent 48d878e commit e1182ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 11 additions & 4 deletions examples/gui_qt_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This is the same as the ``gui_qt_embed.py`` example, except this uses
the asyncio compatible mode that was introduced in Pyside 6.6.
For more info see:
* https://doc.qt.io/qtforpython-6/PySide6/QtAsyncio/index.html
* https://www.qt.io/blog/introducing-qtasyncio-in-technical-preview
"""

# ruff: noqa: N802
Expand All @@ -28,14 +34,15 @@ def __init__(self):
self.canvas = WgpuWidget(splitter)
self.output = QtWidgets.QTextEdit(splitter)

# self.button.clicked.connect(self.whenButtonClicked)
# With QtAsyncio, the callbacks can now return a future. You'd
# think that you could also return a coro, but we need to wrap
# it into a future, making this code a bit ugly.
# self.button.clicked.connect(self.whenButtonClicked) # why not :/
self.button.clicked.connect(
lambda: asyncio.ensure_future(self.whenButtonClicked())
)

splitter.addWidget(
self.canvas,
)
splitter.addWidget(self.canvas)
splitter.addWidget(self.output)
splitter.setSizes([400, 300])

Expand Down
4 changes: 1 addition & 3 deletions examples/gui_qt_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ def __init__(self):

self.button.clicked.connect(self.whenButtonClicked)

splitter.addWidget(
self.canvas,
)
splitter.addWidget(self.canvas)
splitter.addWidget(self.output)
splitter.setSizes([400, 300])

Expand Down

0 comments on commit e1182ec

Please sign in to comment.