Developer resource: Tabbed inputs #1162
pyZerrenner
started this conversation in
Ideas
Replies: 1 comment
-
|
Ahh yes, that is nice. Thanks a lot for sharing. I would really like to make the inputs more modular (indeed using tabs and foldable groups and such). But that's just one more thing on the backlog and I don't get around to finishing the stuff I'm working on already. So I'm all the more happy that you shared this for people to use!!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While writing a measurement program with PyMeasure, I developed a couple of features that I would like to share with the community. They are not very user friendly, so I provide the scripts "as-is" and you can use them at you own risk. I encourage you to first understand the code before implementing it in your program.
If there are a lot of inputs in a program, PyMeasure provides a scrollbar (see the
inputs_in_scrollareaargument) for when they exceed the window boundaries. I found it more practical to group the inputs into the tabs of aQTabWidgetbased on their purpose (for me those were instrument setup, experiment execution, and experiment parameter).This feature is implemented with a new
TabbedInputsWidgetand aManagedWindow_tabbedthat is used to create the main window. The window'sinputsargument must be set as a dictionary with the keys defining the tab names and the values being lists of inputs for the respective tab. Providing a normal list instead of a dictionary reverts back to the standard behavior. Thetab_startargument of the window allows to define which tab is displayed initially (it must be a key from theinputsdictionary).This feature was implemented for PyMeasure version 0.13.1 and the new classes contain a lot of copied code from their parent classes (mainly from
ManagedWindowBaseandManagedWindow). I do not have the time to check the compatibility to the new 0.14.0 release - if any of the copied code was changed, the new classes probably have to be re-implemented.Below is a zip file containing an MWE for tabbed inputs. The files are
TabbedInputsWidgetbased onInputsWidget.ManagedWindow_tabbedthat allows for the use of tabbed inputs.MWE_TabbedInputs.zip
Beta Was this translation helpful? Give feedback.
All reactions