hi again I try to create my custom window adding caption bar i want
that see like the AuiPaneInfo and works like that but that not have
docking. can you help me?
that i need know if using wxPyControl like captionbar but how place in
top of the window? i using the wxBoxSizer to do it but at moment to
add a control on it calling the window class or simply telling me how
works the AuiPaneInfo that have all that i need know where find the
draw of caption, the manage size of it and split between the control
I got this
import wx
class CaptionBar(wx.PyControl):
def __ini__(self, parent, id, pos=wx.DefaultPosition,
size=wx.DefaultSize):
wx.PyControl.__init__(self, parent, id, pos, size)
#self.frame = frame
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.Bind(wx.EVT_SIZE, self.OnSize)
def OnPaint(self, event):
dc = wx.PaintDC(self)
size = self.GetClientSize()
#rect = wx.Rect()
dc.DrawRectangle(0, 0, size.x, 20)
dc.SetBrush(wx.RED_BRUSH)
dc.SetPen(wx.BLACK_PEN)
dc.DrawText(12, "Here", "is")
def OnEraseBackground(self, event):
pass
def OnSize(self, size):
self.Refresh()
class MainFrame( wx.Frame ): # This frame is for fun. Resizing is
disabled.
def __init__(self, parent, id, title='MainFrame', pos=(300, 100),
size=(400, 400)):
# wx.SYSTEM_MENU is needed to show any buttons at all. Add
just the buttons wanted.
···
#
# DEFAULT_FRAME_STYLE = wx.SYSTEM_MENU + wx.CLOSE_BOX +
wx.CAPTION
# + wx.RESIZE_BORDER + wx.MINIMIZE_BOX +
wx.MAXIMIZE_BOX
frameStyle_noCaption = wx.RESIZE_BORDER # No other style
options are wanted.
wx.Frame.__init__( self, parent, -1, title=title, pos=pos,
size=size,
style=frameStyle_noCaption )
captionbar = CaptionBar(self, -1)
panel = wx.Panel( self, -1 )
panel.SetSize( self.GetClientSize() ) # "client" is the
frame.
panel.SetBackgroundColour( (0, 0, 100) )
box = wx.BoxSizer(wx.VERTICAL)
box.Add(captionbar, 0, wx.EXPAND)
box.Add(panel, 1, wx.EXPAND)
self.SetSizer(box)
app = wx.App()
MainFrame(None, -1, title).Show()
app.MainLoop()