Python Forum
Looking for new example wxpython AUI code
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking for new example wxpython AUI code
#1
Hi,

I have been playing with the new wxpython phoenix and like very much what I am finding.
I am especially interested in the Advanced User Interface module that is a pure python
rewrite by Andrea Gavana and can be found in wx.lib.agw.aui.

There's some pretty powerful stuff here, dock-able windows and toolbars, resizable partitioned windows (or frames)
and lots more. What's missing are documentation on a lot of the new features, even though in general the documentation
is pretty good.

Examples are few and far between (there's a few good ones in the demo app) just as an example, here's
a screenshot of the AUI docking window manager:

   
click to enlarge

I am hoping there will be some interest here, to try and get some sample code put together. I'm
doing my best, and will create tutorials when I'm ready to do so. I'm currently working on the multi column
window, and have created a generic basic manager window (code below).

I am excited about what I am finding, I think it would be great if this could replace tkinter as a pre-packeged
GUI.

So if you're looking to play with something new, I'd love some company creating example code.
For noobs, I have a tutorial on installation here https://python-forum.io/Thread-How-to-in...om-scratch

Here's the basic manager window as it stands now:
import wx
import wx.aui
from win32api import GetSystemMetrics


class BasicApp(wx.Frame):
   def __init__(self,
                parent=None,
                id=wx.ID_ANY,
                title='Basic App',
                pos=(50, 50),
                size=(400, 400),
                style=wx.DEFAULT_FRAME_STYLE,
                screen_factor=.5):
       self.screen_factor = screen_factor
       self.get_screen_info()

       wx.Frame.__init__(
           self, parent=None, id=wx.ID_ANY, title='Basic App', pos=(self.hoffset, self.voffset),
           size=(self.scwidth, self.scheight), style=wx.DEFAULT_FRAME_STYLE,
           name='BasicApp'
       )

       self.initialize_components()
       self.CreateStatusBar()
       self.Show()

   def initialize_components(self):
       self._mgr = wx.aui.AuiManager()
       self._mgr.SetManagedWindow(self)

       self._perspectives = []

       self._mgr.Update()

       self.Bind(wx.EVT_CLOSE, self.on_close)

   def get_screen_info(self):
       self.screen_width = GetSystemMetrics(0)
       self.screen_height = GetSystemMetrics(1)
       self.scwidth = int(self.screen_width * self.screen_factor)
       self.scheight = int(self.screen_height * self.screen_factor)
       self.hoffset = int((self.screen_width * .2) / 2)
       self.voffset = int((self.screen_height * .2) / 2)

   def on_close(self, event):
       self._mgr.UnInit()
       del self._mgr
       self.Destroy()


def main():
   app = wx.App()
   BasicApp()
   # frame.Show(True)
   app.MainLoop()

if __name__ == '__main__':
   main()
Reply


Messages In This Thread
Looking for new example wxpython AUI code - by Larz60+ - Jun-18-2017, 02:34 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020