Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 89edd73

Browse filesBrowse files
committed
Check for already running QApplication in Qt embedding example.
1 parent 9faf231 commit 89edd73
Copy full SHA for 89edd73

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎examples/user_interfaces/embedding_in_qt_sgskip.py

Copy file name to clipboardExpand all lines: examples/user_interfaces/embedding_in_qt_sgskip.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ def _update_canvas(self):
5858

5959

6060
if __name__ == "__main__":
61-
qapp = QtWidgets.QApplication(sys.argv)
61+
# Check whether there is already a running QApplication (e.g., if running
62+
# from an IDE).
63+
qapp = QtWidgets.QApplication.instance()
64+
if not qapp:
65+
qapp = QtWidgets.QApplication(sys.argv)
66+
6267
app = ApplicationWindow()
6368
app.show()
6469
qapp.exec_()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.