pyqt context menu with multiple qlineedit widgets - python-3.x

I hope someone can help me out with this.
I have a pyqtgraph context menu and want to add my own Z-Axis. I can create a qlineedit widget but I am not able to create multiple widget on the same line in the context menu as show below (e.g. radio button and 2 text boxes on same line)
As a minimum I would like to achieve:-
Z Axis -> [input value], string, [input value]
I've had a look in qmenu but couldn't find what I needed. Anyone know how to achieve this.
Also if anyone knows how to change the size of the X Axis qlineedit boxes and make them bigger it would be great as they are a bit squashed as you can see.

Someone on a different forum was able to help me with the answer so I thought I would also post it here for future users.
What you have to do is go into the site-packages for python and find pyqtgraph/graphicsItems/ViewBox/. In there are several files called
axisCtrlTemplate_*.py
A couple of lines down in the ui_form is the following line which you just need to increase the width (e.g. 450)
Form.setMaximumSize(QtCore.QSize(450, 16777215))
Hey presto fixed.
Also in the same location is a file called
ViewBoxMenu.py
you can see how the context menu is written here and I will use this information to create my min and max values which are created in a ui (qtdesigner) and then added to the menu

Related

PYQT Taking a screenshot of a hidden QWidget

I have a QTabWidget with different tabs.
I want to take a screenshot of a hidden tab.
I found out how to create a screenshot of the tab if it's selected now.
The problem is that I want to be able to do that even if another tab was selected.
The solution was very simple in the end, I hope it would help someone if he needs to.
To capture a screenshot of a widget you have in your application, even if it's not currently visible.
For example if you have a number of tabs in your QTabWidget:
# tabs_hash is a dictionary of the widgets we have in the QTabWidget,
# or any widget we have in the application we want to print
for name in tabs_hash:
file = f'{name}.jpeg'
tabs_hash[name].grab().save(file)

Center and put multiple items on the same line using Tkinter

I want to put a Label and an Entry widgets on the same line and center them.
I saw on multiple posts that to center, pack() method was easier. But, to put on the same line, it's grid().
With grid(), I suppose I have to build all the layout, then center it. Is there a way to do it on the go? With pack(), I don't have any idea.
But, I want to do both at the same time. I didn't find any answer :/
If someone can help me, I will be very grateful!
I have to put everything in a frame and pack() the frame.
Thanks to #acw1668

Windows Explorer Navigation Bar in PyQt

What's the best approach to mimic the Windows Explorer navigation bar in PyQt?. Perhaps a list of QComboBoxes as part of a parent class that concatenates the current item of each combo box to resolve the final path?
Is it possible to get a similar look by using stylesheets?
This is the object I need to mimic. I just want a theoretical approach about the best way to mimic it.
Thanks in advance
This is technically known as a breadcrumb widget.
There are multiple approaches to this. The closest emulation to Windows Explorer's behavior--leaving out the normally hidden line editor--involves a chain of widgets like so:
A top level parent QWidget-derived class with your implementation, which would have:
A QHBoxLayout
An arbitrary number of QComboBoxes
A QFileSystemModel from which to populate the combo boxes.
Alternatives
You could use a single QLabels with a series of hyperlinks divided by path separators if you don't care about drop-down behavior. Qt Creator does this.
If your data source is static and not as gigantic as the filesystem, you could use QToolButtons backed by a tree of QAction/QMenus. This is possibly a masochistic approach, given that you have to populate all of the actions and menus. Since that's what they are there for, though, it might be handy as part of a context-sensitive menubar or tab bar.
I was looking for such a widget too without any luck. So I've tried to implement this by myself. It's not finished yet and needs some more work, but here's the first result: breadcrumbsaddressbar.
It's based on QToolButton widgets with menu. Parts of address which don't fit are hidden like in Windows Explorer. Also the widget has auto-completion feature.
Update: there's also a C++ widget QtAddressBar which I have't tried.

wx Python Menu affecting display

I have two fairly large python apps using wx python for the gui. The menu bar seems to affect the display in a way that I cannot understand. In one, the menu bar appears on Show, but it pushes down the remaining controls, and the bottom ones are half off the screen. I.e. Fit() does not seem to take the menubar into account.
On the second I have a similar problem, but here the menu bar does not appear until the cursor is placed on the main panel. Then the menubar appears and pushes down the remaining controls.
I've tried to produce a skeleton screen that duplicates the problem, but I cannot, so I'm looking for pointers as to the possible cause of the problem. Can anyone suggest where to try to solve it?

GXT, how to display the widgets labels with a VBOXLayout

I have been trying to resolve this by myself but I can't find any answers. I need the text fields the combo box, etc., to display its own label, but I can't put it to work on a panel different from the FormPanel (in which all works great). I'm trying to display the labels for a text field on a VBoxLayout but I don't find the way to do it.
I need to work with a VBoxLayout because I need the widgets to position in the middle of the form after the window is maximized or minimized and this layout is the only one that proves to work. Is there another way to accomplish this?
Add another LayoutContainer and then set the panel to use FormLayout for example
LayoutContainer innerPanel = new LayoutContainer();
innerPanel.setLayout(new FormLayout());
Now it will work just like a form panel.

Resources