문제

I am buiding a GUI where I have a wxribbon with few pages and on each page, I have few panels with buttons on them. What I want is to allow users to be able to drag panels on a page to reorder them according to their need. I am a newbie to wxpython and I have no idea how to do it. I just need some as guidance as to how to do this. Any help would be great. Thanks. I have attached a simple ribbon code with panels.

self._ribbon = RB.RibbonBar(self, wx.ID_ANY, size = (1368,350), style = RB.RIBBON_BAR_DEFAULT_STYLE | RB.RIBBON_BAR_ALWAYS_SHOW_TABS)

workpiece = RB.RibbonPage(self._ribbon, WORKPIECE, "Workpiece", Bitmap("eye.xpm"))
panel1 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))
panel2 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))
panel3 = RB.RibbonPanel(workpiece,wx.ID_ANY,"New Block",Bitmap("selection_panel.xpm"))
도움이 되었습니까?

해결책

Unfortunately, that feature is not built-in to wxPython. The closest thing that I am aware of is "dockable" pains in the AUI framework. I would recommend looking at that, especially the pure Python version of AUI that is in wx.lib.agw.aui. You can see an example of its use in the wxPython demo.

I am thinking that you might be able to use a dock from that inside your ribbon control and add docked panes to it that can then be moved around. I'm not sure if this will work the way you expect, but it's the best available without creating something new. Otherwise you will have to create a custom widget.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top