Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 738518a

Browse files
authored
Merge pull request #22288 from impact27/patch-2
DOC: update documentation after #18966
2 parents cc6854c + 795288d commit 738518a

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

lib/matplotlib/backends/qt_editor/_formlayout.py

Lines changed: 19 additions & 11 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

@@ -498,8 +499,7 @@ def get(self):
498499

499500
def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
500501
"""
501-
Create form dialog and return result
502-
(if Cancel button is pressed, return None)
502+
Create form dialog
503503
504504
data: datalist, datagroup
505505
title: str
@@ -541,6 +541,8 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
541541

542542
if __name__ == "__main__":
543543

544+
_app = QtWidgets.QApplication([])
545+
544546
def create_datalist_example():
545547
return [('str', 'this is a string'),
546548
('list', [0, '1', '3', '4']),
@@ -568,18 +570,24 @@ def create_datagroup_example():
568570

569571
def apply_test(data):
570572
print("data:", data)
571-
print("result:", fedit(datalist, title="Example",
572-
comment="This is just an <b>example</b>.",
573-
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()
574578

575579
# --------- datagroup example
576580
datagroup = create_datagroup_example()
577-
print("result:", fedit(datagroup, "Global title"))
581+
fedit(datagroup, "Global title",
582+
apply=apply_test)
583+
_app.exec()
578584

579585
# --------- datagroup inside a datagroup example
580586
datalist = create_datalist_example()
581587
datagroup = create_datagroup_example()
582-
print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"),
583-
(datalist, "Title 2", "Tab 2 comment"),
584-
(datalist, "Title 3", "Tab 3 comment")),
585-
"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)