wxPython: Placement of scrollbar in ScrolledPanel - python

I was wondering if there is any way to control the location of the scrollbar from a scrolledpanel? More specifically: I use a horizontally scrolled panel and it would be nice if the scrollbar was on top of the panel (instead of bottom) and would only span 80% of the horizontal distance.
Is something like this possible?
Thanks...

Related

How to create a rounded scrollbar with style in tkinter python

I'm looking for how to create a rounded scrollbar with style method in tkinter.
Also, is it possible to set trough color when our mouse enter scrollbar trough?
This is a example about the scrollbar which I'm taking about.
https://i.stack.imgur.com/OHpm7.jpg
Thanks in advance for your helps!

Grouping multiple buttons with absolute positioning in a layout

Is it possible to group buttons that are arbitrarily positionned with PyQt ?
There is the context :
I would like to code a visual programm to control a research system with specific geometry, through Python.
I expect this kind of result :
In this program, the buttons of "buttons group 3" are positionned is a specific geometry that does not fit in a grid. Those buttons are clickable and a click on them change their color.
I would like those buttons to be grouped together, in something like a layout, because it seems to be that it is coherent in order to change positions and sizes of layouts and window if needed.
I'm coding that with PYQT5,... but I cannot figure in PyQt5 how to code this group of buttons with specific geometry ?
Is it possible to group buttons that are arbitrarily positionned with PyQt ?
Thanks in advance for your advice, I feel I'm missing something in PyQt concept.

PYQT Widget in Layout

I am Trying to figure out how to get a widget centered and fully shown in a layout.
The following code creates the widget and places it in the vertical layout just fine. However the widget is not centered in the layout and the bottom half is cut off.
widget = QtGui.QWidget()
FRM_widget = gsFRMPlaybackWidget.Ui_Form()
FRM_widget.setupUi(widget)
g_mainWindow.verticalLayout_mode.addWidget(widget,0)
The vertical layout is empty initially. I add a widget to it, then remove it later. The widget that is added is based on a combox selection. The contents and size of the widget will be different.
It will create the widget from another .py file (which is imported).
Is there some option for the vertical layout that I need to set? Is there an option for the widget I need to set?
Couldn't find anything that worked online.
I got to work.
In the gsFRMPlaybackWidget code (or designer) I had to set the forms layout to horizontally:expanding and vertically:preference for what I needed.

Adding many scrolledpanels to one scrolledPanel in wxPython

Level: Beginner
I am developing a GUI with wxPython on Windows 7 OS. Python version is 2.7 ad wxPython version is 3. My GUI looks as shown in the image below:
I would like to take some time to explain what I am trying to achieve. As you mayhave noticed from the first image that there are 4 different scrolled panels in my GUI named as panel-1 to panel-4. A vertical BoxSizer is applied to each scrolled panel. Each scrolled panel in return contains a boxsizer and a horizontal wx.StaticLine. The reason for using horizontal line was to make it is easier for the user to read the values for a particular serial number. (It will be easy for an user to read all the values in different panels for a particular serial number.) Finally all these four scrolled panels are added to a horizontal BoxSizer named as panelSizer. Currently the scrolled panels are scrolling individually. One important thing is that all the scrolled panels will every time contain same number of components/elements.
Problem:
I need a way so that I can add all these scrolled panels to one sizer or a panel in such a way that there is only one scroll bar at right side and when I scroll this scrollbar all the scrolled panels (panel-1 to panel-4) should scroll simultaneously. I would like to have something like this:
I think this option is better from the GUI perspective. I have tried couple of things like, I created a new scrolled panel named as main panel, and applied the BoxSizer named as panelSizer (it contains all the panel from panel-1 to panel-4) using SetSizer() function, but the scroll bar doesn't appears, even the individual scroll bars doesn't appear! Also, I have checked that there are enough components in the panels so that scroll bars appears. I tried to change the four scrolled panels to simple panels and then add to the panelSizer and then applied the sizer to the main panel but nothing solved the problem..
Can anyone suggest what is wrong with my approach? Any suggestion. Thank you for your time.
Well I found the solution myself so here it goes.
I have to disable scrolling on the panels-1 to panel-4. This can be done by not using SetupScrolling() method on them. Also, the scrolling should be enabled on the mainPanel like this:
mainPanel.SetupScrolling()
For an example: Consider that you have two scrolled panels named as panel1 and panel2. Now if you want to add these two scrolled panels to an other scrolled panel named as mainPanel, then you first create these two scrolled panels and then disable scrolling on them then add these two panels two a sizer, then apply this sizer to the mainPanel.
Code example:
mainPanel = wx.lib.scrolledpanel.ScrolledPanel(self, -1,style=wx.SIMPLE_BORDER)
mainPanel.SetupScrolling()
panel1 = wx.lib.scrolledpanel.ScrolledPanel(mainPanel, -1, style=wx.SIMPLE_BORDER)
panel2 = wx.lib.scrolledpanel.ScrolledPanel(mainPanel, -1, style=wx.SIMPLE_BORDER)
panelSizer = wx.BoxSizer(wx.HORIZONTAL)
panelSizer.Add(panel1)
panelSizer.Add(panel2)
mainPanel.SetSizer(panelSizer)

Matplotlib zooming work in conjunction with wxPython ScrolledWindow

I've got a Matplotlib canvas (FigureCanvasWxAgg) that I'm displaying inside of a wx.ScrolledWindow. The problem is that I'd like to have the default zooming and panning functionality of Matplotlib work in conjunction with the ScrolledWindow, so that when the user zooms the image within the canvas, the ScrolledWindow should become larger to accommodate for the zooming (scrollbars become smaller). Similarly for panning, I'd like the default matplotlib panning tool to work in conjunction with our ScrolledWindow, so that when the user pans the image on the canvas, the ScrolledWindow's scrollbars should move accordingly.
I've been searching for a while now and have not seen anyone even mention if this is possible. Could anyone point me in the right direction?
Thank you for any help/tips.
The problem is that the default Zoom and Pan don't resize the figure, they just change the limits and redraw the plot.
What you want is the Zoom to resize (keeping the same limits) and the Pan to work as in a normal Scrolled window. I have never tried this, fig.set_size_inches(w,h) should do the trick.

Categories