10000 fix example · matplotlib/matplotlib@795288d · GitHub
[go: up one dir, main page]

Skip to content

Commit 795288d

Browse files
author
Quentin Peter
committed
fix example
1 parent 5cfaad8 commit 795288d

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

lib/matplotlib/backends/qt_editor/_formlayout.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
from numbers import Integral, Real
4848

4949
from matplotlib import _api, colors as mcolors
50-
from ..qt_compat import QtGui, QtWidgets, QtCore, _enum, _to_int
50+
from matplotlib.backends.qt_compat import (
51+
QtGui, QtWidgets, QtCore, _enum, _to_int)
5152

5253
_log = logging.getLogger(__name__)
5354

@@ -540,6 +541,8 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
540541

541542
if __name__ == "__main__":
542543

544+
_app = QtWidgets.QApplication([])
545+
543546
def create_datalist_example():
544547
return [('str', 'this is a string'),
545548
('list', [0, '1', '3', '4']),
@@ -567,18 +570,24 @@ def create_datagroup_example():
567570

568571
def apply_test(data):
569572
print("data:", data)
570-
print("result:", fedit(datalist, title="Example",
571-
comment="This is just an <b>example</b>.",
572-
apply=apply_test))
573+
fedit(datalist, title="Example",
574+
comment="This is just an <b>example</b>.",
575+
apply=apply_test)
576+
577+
_app.exec()
573578

574579
# --------- datagroup example
575580
datagroup = create_datagroup_example()
576-
print("result:", fedit(datagroup, "Global title"))
581+
fedit(datagroup, "Global title",
582+
apply=apply_test)
583+
_app.exec()
577584

578585
# --------- datagroup inside a datagroup example
579586
datalist = create_datalist_example()
580587
datagroup = create_datagroup_example()
581-
print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"),
582-
(datalist, "Title 2", "Tab 2 comment"),
583-
(datalist, "Title 3", "Tab 3 comment")),
584-
"Global title"))
588+
fedit(((datagroup, "Title 1", "Tab 1 comment"),
589+
(datalist, "Title 2", "Tab 2 comment"),
590+
(datalist, "Title 3", "Tab 3 comment")),
591+
"Global title",
592+
apply=apply_test)
593+
_app.exec()

0 commit comments

Comments
 (0)
0