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
Discussion options

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_scrollarea argument) for when they exceed the window boundaries. I found it more practical to group the inputs into the tabs of a QTabWidget based on their purpose (for me those were instrument setup, experiment execution, and experiment parameter).

This feature is implemented with a new TabbedInputsWidget and a ManagedWindow_tabbed that is used to create the main window. The window's inputs argument 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. The tab_start argument of the window allows to define which tab is displayed initially (it must be a key from the inputs dictionary).

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 ManagedWindowBase and ManagedWindow). 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

  • MWE_TabbedInputs_widget.py: Defines the TabbedInputsWidget based on InputsWidget.
  • MWE_TabbedInputs_window.py: Defines the window ManagedWindow_tabbed that allows for the use of tabbed inputs.
  • MWE_TabbedInputs.py: A minimal working example , that shows the functionality of the widget.

MWE_TabbedInputs.zip

MWE_TabbedInputs_Screenshot1+2

You must be logged in to vote

Replies: 1 comment

Comment options

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!!!

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.