Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your OnInit you just need to call your dialogs and show them modally BEFORE you create your Board instance. Then it should work correctly.</p> <p><strong>EDIT (6-28-12):</strong> Here's some code:</p> <pre><code>import wx ######################################################################## class MyDlg(wx.Dialog): """""" #---------------------------------------------------------------------- def __init__(self): """Constructor""" wx.Dialog.__init__(self, None, title="I'm a dialog!") lbl = wx.StaticText(self, label="Hi from the panel's init!") btn = wx.Button(self, id=wx.ID_OK, label="Close me") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 0, wx.ALL, 5) sizer.Add(btn, 0, wx.ALL, 5) self.SetSizer(sizer) ######################################################################## class MyPanel(wx.Panel): """""" #---------------------------------------------------------------------- def __init__(self, parent): """Constructor""" wx.Panel.__init__(self, parent) # show a custom dialog dlg = MyDlg() dlg.ShowModal() dlg.Destroy() self.Bind(wx.EVT_PAINT, self.OnPaint) def OnPaint(self, evt): pdc = wx.PaintDC(self) try: dc = wx.GCDC(pdc) except: dc = pdc rect = wx.Rect(0,0, 100, 100) for RGB, pos in [((178, 34, 34), ( 50, 90)), (( 35, 142, 35), (110, 150)), (( 0, 0, 139), (170, 90)) ]: r, g, b = RGB penclr = wx.Colour(r, g, b, wx.ALPHA_OPAQUE) brushclr = wx.Colour(r, g, b, 128) # half transparent dc.SetPen(wx.Pen(penclr)) dc.SetBrush(wx.Brush(brushclr)) rect.SetPosition(pos) dc.DrawRoundedRectangleRect(rect, 8) ######################################################################## class MyFrame(wx.Frame): """""" #---------------------------------------------------------------------- def __init__(self): """Constructor""" wx.Frame.__init__(self, None, title="Example frame") # show a MessageDialog style = wx.OK|wx.ICON_INFORMATION dlg = wx.MessageDialog(parent=None, message="Hello from the frame's init", caption="Information", style=style) dlg.ShowModal() dlg.Destroy() # create panel panel = MyPanel(self) if __name__ == "__main__": app = wx.App(False) frame = MyFrame() frame.Show() app.MainLoop() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload