Skip to content

Commit 157c878

Browse files
committed
Added example
1 parent 3ae20f3 commit 157c878

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

examples/floatedit.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python
2+
# /*##########################################################################
3+
#
4+
# Copyright (c) 2016-2021 European Synchrotron Radiation Facility
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in
14+
# all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
# THE SOFTWARE.
23+
#
24+
# ###########################################################################*/
25+
"""
26+
Test FloatEdit widgets
27+
"""
28+
29+
from silx.gui import qt
30+
from silx.gui.widgets.FloatEdit import FloatEdit
31+
32+
33+
class Dialog(qt.QMainWindow):
34+
def __init__(self, *args, **kwargs):
35+
qt.QMainWindow.__init__(self, *args, **kwargs)
36+
37+
widget = qt.QWidget(self)
38+
layout = qt.QHBoxLayout(widget)
39+
40+
f1 = FloatEdit(self)
41+
layout.addWidget(f1)
42+
43+
f2 = FloatEdit(self)
44+
layout.addWidget(f2)
45+
46+
f3 = FloatEdit(self)
47+
f3.setWidgetResizable(True)
48+
layout.addWidget(f3)
49+
50+
b = qt.QPushButton(self)
51+
b.setText("f3=100")
52+
b.clicked.connect(lambda: f3.setValue(100))
53+
layout.addWidget(b)
54+
55+
self.setCentralWidget(widget)
56+
57+
58+
if __name__ == "__main__":
59+
app = qt.QApplication([])
60+
window = Dialog()
61+
window.setVisible(True)
62+
app.exec()

0 commit comments

Comments
 (0)