Customized caption box dialog (Phoenix)

Keywords : Dialog, CaptionBox, BufferedPaintDC, GCDC.


Demonstrating :

Tested py3.x, wx4.x and Win10.

Are you ready to use some samples ? ;)

Test, modify, correct, complete, improve and share your discoveries ! (!)


With rounded rectangle

img_sample_one.png

ICON file : icon_wxWidgets.ico

   1 # sample_one.py
   2 
   3 import sys
   4 import os
   5 import wx
   6 
   7 # class MyCaptionBox
   8 # class MyDialog
   9 # class MyFrame
  10 # class MyApp
  11 
  12 #---------------------------------------------------------------------------
  13 
  14 class MyCaptionBox(wx.Panel):
  15     """
  16     ...
  17     """
  18     def __init__(self, parent, caption):
  19         """
  20         ...
  21         """
  22         super(MyCaptionBox, self).__init__(parent,
  23                                            style=wx.NO_BORDER |
  24                                            wx.TAB_TRAVERSAL)
  25 
  26         #------------
  27 
  28         # Attributes.
  29         self._caption = caption
  30         self._csizer = wx.BoxSizer(wx.VERTICAL)
  31 
  32         #------------
  33 
  34         # Simplified init method.
  35         self.BindEvents()
  36         self.DoLayout()
  37 
  38     #-----------------------------------------------------------------------
  39 
  40     def BindEvents(self):
  41         """
  42         Binds the events to specific methods.
  43         """
  44 
  45         self.Bind(wx.EVT_PAINT, self.OnPaint)
  46         self.Bind(wx.EVT_SIZE, self.OnSize)
  47 
  48 
  49     def DoLayout(self):
  50         """
  51         ...
  52         """
  53 
  54         msizer = wx.BoxSizer(wx.HORIZONTAL)
  55         self._csizer.AddSpacer(25)     # Extra space for caption.
  56         msizer.Add(self._csizer, 0, wx.EXPAND|wx.ALL, 15)
  57         self.SetSizer(msizer)
  58 
  59 
  60     def DoGetBestSize(self):
  61         """
  62         ...
  63         """
  64 
  65         self.Refresh()
  66 
  67         size = super(MyCaptionBox, self).DoGetBestSize()
  68 
  69         # Compensate for wide caption labels.
  70         tw = self.GetTextExtent(self._caption)[0]
  71         size.SetWidth(max(size.width, tw+40))  # Box width.
  72 
  73         return size
  74 
  75 
  76     def AddItem(self, item):
  77         """
  78         Add a window or sizer item to the settingCaptionBox.
  79         """
  80 
  81         self._csizer.Add(item, 0, wx.ALL, 5)
  82 
  83 
  84     def OnSize(self, event):
  85         """
  86         ...
  87         """
  88 
  89         event.Skip()
  90         self.Refresh()
  91 
  92 
  93     def OnPaint(self, event):
  94         """
  95         Draws the Caption and border around the controls.
  96         """
  97 
  98         dc = wx.BufferedPaintDC(self)
  99         dc.Clear()
 100         gcdc = wx.GCDC(dc)
 101 
 102         gc = gcdc.GetGraphicsContext()
 103 
 104         # Get the working rectangle we can draw in.
 105         rect = self.GetClientRect()
 106 
 107         # Get the sytem color to draw the caption.
 108         ss = wx.SystemSettings
 109         color = "#165817"
 110         txtcolor = ss.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)
 111         gcdc.SetTextForeground(txtcolor)
 112 
 113         # Font, size and style for the caption.
 114         font = self.GetFont().GetPointSize()
 115         font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
 116         font.SetWeight(wx.BOLD)
 117 
 118         # Draw the border.
 119         rect.Inflate(-10, -10)
 120         # Stroke color and thickness.
 121         gcdc.SetPen(wx.Pen(color, 2, wx.SOLID))
 122         gcdc.SetBrush(wx.TRANSPARENT_BRUSH)
 123         gcdc.DrawRoundedRectangle(rect, 8)
 124 
 125         # Gradient caption (green ---> black).
 126         color1 = wx.Colour(41, 167, 44)
 127         color2 = wx.Colour(0, 0, 0)
 128         x1, y1 = rect.x, rect.y
 129         y2 = y1 + 25
 130 
 131         gradbrush = gc.CreateLinearGradientBrush(x1, y1,
 132                                                  x1, y2,
 133                                                  color1,
 134                                                  color2)
 135         gc.SetBrush(gradbrush)
 136 
 137         # Add the caption.
 138         rect = wx.Rect(rect.x, rect.y,
 139                        rect.width, 26)  # Caption size.
 140         dc.SetBrush(wx.Brush(color))
 141         gcdc.DrawRoundedRectangle(rect, 8)
 142         rect.Inflate(-5, 0)
 143         gcdc.SetFont(font)
 144         gcdc.DrawLabel(self._caption, rect, wx.ALIGN_CENTER)
 145 
 146 #---------------------------------------------------------------------------
 147 
 148 class MyDialog(wx.Dialog):
 149     """
 150     ...
 151     """
 152     def __init__(self, parent, title,
 153                  pos=wx.DefaultPosition,
 154                  size=wx.DefaultSize):
 155         wx.Dialog.__init__(self,
 156                            parent,
 157                            -1,
 158                            title,
 159                            pos=(-1, -1),
 160                            size=(420, 550),
 161                            style=wx.DEFAULT_FRAME_STYLE)
 162 
 163         #------------
 164 
 165         # Attributes.
 166         self.parent = parent
 167 
 168         #------------
 169 
 170         # Simplified init method.
 171         self.SetProperties()
 172         self.CreateCtrls()
 173         self.DoLayout()
 174 
 175         #------------
 176 
 177         self.CenterOnScreen(wx.BOTH)
 178         print("\nDisplay the caption box dialog")
 179 
 180         #------------
 181 
 182         self.ShowModal()
 183         self.Destroy()
 184 
 185     #-----------------------------------------------------------------------
 186 
 187     def SetProperties(self):
 188         """
 189         ...
 190         """
 191 
 192         frameicon = wx.Icon("icon_wxWidgets.ico")
 193         self.SetIcon(frameicon)
 194 
 195         self.SetMinSize((420, 550))
 196 
 197 
 198     def CreateCtrls(self):
 199         """
 200         ...
 201         """
 202 
 203         self.firstBox = MyCaptionBox(self, "First caption")
 204 
 205         # Create some checkboxes in the box.
 206         for x in range(4):
 207             cb = wx.CheckBox(self.firstBox,
 208                              label="CheckBox %d" % x)
 209             self.firstBox.AddItem(cb)
 210 
 211             self.Bind(wx.EVT_CHECKBOX, self.OnPass, cb)
 212 
 213         #------------
 214 
 215         self.secondBox = MyCaptionBox(self, "Second caption")
 216 
 217         # Create some checkboxes in the box.
 218         for x in range(4):
 219             cb = wx.CheckBox(self.secondBox,
 220                              label="CheckBox %d" % x)
 221             self.secondBox.AddItem(cb)
 222 
 223             self.Bind(wx.EVT_CHECKBOX, self.OnPass, cb)
 224 
 225         #------------
 226 
 227         self.thirdBox = MyCaptionBox(self, "Third caption")
 228 
 229         # Create some checkboxes in the box.
 230         for x in range(4):
 231             cb = wx.CheckBox(self.thirdBox,
 232                              label="CheckBox %d" % x)
 233             self.thirdBox.AddItem(cb)
 234 
 235             self.Bind(wx.EVT_CHECKBOX, self.OnPass, cb)
 236 
 237         #------------
 238 
 239         self.btnSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
 240 
 241 
 242     def DoLayout(self):
 243         """
 244         ...
 245         """
 246 
 247         mainSizer = wx.BoxSizer(wx.HORIZONTAL)
 248         ctrlSizer = wx.BoxSizer(wx.VERTICAL)
 249 
 250         ctrlSizer.Add(self.firstBox, 1, wx.EXPAND)
 251         ctrlSizer.Add(self.secondBox, 1, wx.EXPAND)
 252         ctrlSizer.Add(self.thirdBox, 1, wx.EXPAND)
 253         ctrlSizer.Add(self.btnSizer, 0, wx.EXPAND |
 254                       wx.RIGHT, 5)
 255 
 256         mainSizer.Add(ctrlSizer, 1, wx.EXPAND |
 257                       wx.BOTTOM, 10)
 258 
 259         self.SetSizer(mainSizer)
 260         mainSizer.Layout()
 261 
 262 
 263     def OnPass(self, event):
 264         """
 265         Just grouping the empty event handlers together.
 266         """
 267 
 268         print("Hello !")
 269 
 270         pass
 271 
 272 #---------------------------------------------------------------------------
 273 
 274 class MyFrame(wx.Frame):
 275     """
 276     ...
 277     """
 278     def __init__(self):
 279         super(MyFrame, self).__init__(None,
 280                                       -1,
 281                                       title="")
 282 
 283         #------------
 284 
 285         # Return application name.
 286         self.app_name = wx.GetApp().GetAppName()
 287 
 288         #------------
 289 
 290         # Simplified init method.
 291         self.SetProperties()
 292         self.CreateCtrls()
 293         self.BindEvents()
 294         self.DoLayout()
 295 
 296         #------------
 297 
 298         self.CenterOnScreen()
 299 
 300     #-----------------------------------------------------------------------
 301 
 302     def SetProperties(self):
 303         """
 304         ...
 305         """
 306 
 307         self.SetTitle(self.app_name)
 308 
 309         #------------
 310 
 311         frameicon = wx.Icon("icon_wxWidgets.ico")
 312         self.SetIcon(frameicon)
 313 
 314 
 315     def CreateCtrls(self):
 316         """
 317         ...
 318         """
 319 
 320         # Create a panel.
 321         self.panel = wx.Panel(self, -1)
 322 
 323         #------------
 324 
 325         # Add some buttons.
 326         self.btnDlg = wx.Button(self.panel,
 327                                 -1,
 328                                 "&Show caption box dialog")
 329 
 330         self.btnClose = wx.Button(self.panel,
 331                                   -1,
 332                                   "&Close")
 333 
 334 
 335     def BindEvents(self):
 336         """
 337         Bind some events to an events handler.
 338         """
 339 
 340         # Bind the close event to an event handler.
 341         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 342 
 343         # Bind the buttons event to an event handler.
 344         self.Bind(wx.EVT_BUTTON, self.OnSetting, self.btnDlg)
 345         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.btnClose)
 346 
 347 
 348     def DoLayout(self):
 349         """
 350         ...
 351         """
 352 
 353         # MainSizer is the top-level one that manages everything.
 354         mainSizer = wx.BoxSizer(wx.VERTICAL)
 355 
 356         # wx.BoxSizer(window, proportion, flag, border)
 357         # wx.BoxSizer(sizer, proportion, flag, border)
 358         mainSizer.Add(self.btnDlg, 1, wx.EXPAND | wx.ALL, 10)
 359         mainSizer.Add(self.btnClose, 1, wx.EXPAND | wx.ALL, 10)
 360 
 361         # Finally, tell the panel to use the sizer for layout.
 362         self.panel.SetAutoLayout(True)
 363         self.panel.SetSizer(mainSizer)
 364 
 365         mainSizer.Fit(self.panel)
 366 
 367     #-----------------------------------------------------------------------
 368 
 369     def OnCloseMe(self, event):
 370         """
 371         ...
 372         """
 373 
 374         self.Close(True)
 375 
 376 
 377     def OnSetting(self, event):
 378         """
 379         ...
 380         """
 381 
 382         settingDlg = MyDialog(self,
 383                               title="Caption box dialog")
 384                               #pos=(-1, -1),
 385                               #size=(500, 300))
 386 
 387     def OnCloseWindow(self, event):
 388         """
 389         ...
 390         """
 391 
 392         self.Destroy()
 393 
 394 #---------------------------------------------------------------------------
 395 
 396 class MyApp(wx.App):
 397     """
 398     ...
 399     """
 400     def OnInit(self):
 401 
 402         #------------
 403 
 404         self.SetAppName("Main frame")
 405 
 406         #------------
 407 
 408         self.installDir = os.path.split(os.path.abspath(sys.argv[0]))[0]
 409 
 410         #------------
 411 
 412         frame = MyFrame()
 413         self.SetTopWindow(frame)
 414         frame.Show(True)
 415 
 416         return True
 417 
 418     #-----------------------------------------------------------------------
 419 
 420     def GetInstallDir(self):
 421         """
 422         Returns the installation directory for my application.
 423         """
 424 
 425         return self.installDir
 426 
 427 #---------------------------------------------------------------------------
 428 
 429 def main():
 430     app = MyApp(False)
 431     app.MainLoop()
 432 
 433 #---------------------------------------------------------------------------
 434 
 435 if __name__ == "__main__" :
 436     main()


With rectangle

img_sample_two.png

ICON file : icon_wxWidgets.ico

   1 # sample_two.py
   2 
   3 import sys
   4 import os
   5 import wx
   6 
   7 # class MyCaptionBox
   8 # class MyDialog
   9 # class MyFrame
  10 # class MyApp
  11 
  12 #---------------------------------------------------------------------------
  13 
  14 class MyCaptionBox(wx.Panel):
  15     """
  16     ...
  17     """
  18     def __init__(self, parent, caption):
  19         """
  20         ...
  21         """
  22         super(MyCaptionBox, self).__init__(parent,
  23                                            style=wx.NO_BORDER |
  24                                            wx.TAB_TRAVERSAL)
  25 
  26         #------------
  27 
  28         # Attributes.
  29         self._caption = caption
  30         self._csizer = wx.BoxSizer(wx.VERTICAL)
  31 
  32         #------------
  33 
  34         # Simplified init method.
  35         self.BindEvents()
  36         self.DoLayout()
  37 
  38     #-----------------------------------------------------------------------
  39 
  40     def BindEvents(self):
  41         """
  42         Binds the events to specific methods.
  43         """
  44 
  45         self.Bind(wx.EVT_PAINT, self.OnPaint)
  46         self.Bind(wx.EVT_SIZE, self.OnSize)
  47 
  48 
  49     def DoLayout(self):
  50         """
  51         ...
  52         """
  53 
  54         msizer = wx.BoxSizer(wx.HORIZONTAL)
  55         self._csizer.AddSpacer(25)     # Extra space for caption.
  56         msizer.Add(self._csizer, 0, wx.EXPAND|wx.ALL, 15)
  57         self.SetSizer(msizer)
  58 
  59 
  60     def DoGetBestSize(self):
  61         """
  62         ...
  63         """
  64 
  65         self.Refresh()
  66 
  67         size = super(MyCaptionBox, self).DoGetBestSize()
  68 
  69         # Compensate for wide caption labels.
  70         tw = self.GetTextExtent(self._caption)[0]
  71         size.SetWidth(max(size.width, tw+40))  # Box width.
  72 
  73         return size
  74 
  75 
  76     def AddItem(self, item):
  77         """
  78         Add a window or sizer item to the settingCaptionBox.
  79         """
  80 
  81         self._csizer.Add(item, 0, wx.ALL, 5)
  82 
  83 
  84     def OnSize(self, event):
  85         """
  86         ...
  87         """
  88 
  89         event.Skip()
  90         self.Refresh()
  91 
  92 
  93     def OnPaint(self, event):
  94         """
  95         Draws the Caption and border around the controls.
  96         """
  97 
  98         dc = wx.BufferedPaintDC(self)
  99         dc.Clear()
 100         gcdc = wx.GCDC(dc)
 101 
 102         gc = gcdc.GetGraphicsContext()
 103 
 104         # Get the working rectangle we can draw in.
 105         rect = self.GetClientRect()
 106 
 107         # Get the sytem color to draw the caption.
 108         ss = wx.SystemSettings
 109         color = wx.Colour(125, 125, 125)
 110         txtcolor = ss.GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT)
 111         gcdc.SetTextForeground(txtcolor)
 112 
 113         # Font, size and style for the caption.
 114         font = self.GetFont().GetPointSize()
 115         font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
 116         font.SetWeight(wx.BOLD)
 117 
 118         # Draw the border.
 119         rect.Inflate(-10, -10)
 120         # Stroke color and thickness.
 121         gcdc.SetPen(wx.Pen(color, 2, wx.SOLID))
 122         gcdc.SetBrush(wx.TRANSPARENT_BRUSH)
 123         gcdc.DrawRectangle(rect)
 124 
 125         # Gradient caption (green ---> black).
 126         color1 = wx.Colour(255, 0, 0)
 127         color2 = wx.Colour(0, 0, 0)
 128         x1, y1 = rect.x, rect.y
 129         y2 = y1 + 25
 130 
 131         gradbrush = gc.CreateLinearGradientBrush(x1, y1,
 132                                                  x1, y2,
 133                                                  color1,
 134                                                  color2)
 135         gc.SetBrush(gradbrush)
 136 
 137         # Add the caption.
 138         rect = wx.Rect(rect.x, rect.y,
 139                        rect.width, 26)  # Caption size.
 140         dc.SetBrush(wx.Brush(color))
 141         gcdc.DrawRectangle(rect)
 142         rect.Inflate(-5, 0)
 143         gcdc.SetFont(font)
 144         gcdc.DrawLabel(self._caption, rect, wx.ALIGN_CENTER)
 145 
 146 #---------------------------------------------------------------------------
 147 
 148 class MyDialog(wx.Dialog):
 149     """
 150     ...
 151     """
 152     def __init__(self, parent, title,
 153                  pos=wx.DefaultPosition,
 154                  size=wx.DefaultSize):
 155         wx.Dialog.__init__(self,
 156                            parent,
 157                            -1,
 158                            title,
 159                            pos=(-1, -1),
 160                            size=(420, 550),
 161                            style=wx.DEFAULT_FRAME_STYLE)
 162 
 163         #------------
 164 
 165         # Attributes.
 166         self.parent = parent
 167 
 168         #------------
 169 
 170         # Simplified init method.
 171         self.SetProperties()
 172         self.CreateCtrls()
 173         self.DoLayout()
 174 
 175         #------------
 176 
 177         self.CenterOnScreen(wx.BOTH)
 178         print("\nDisplay the caption box dialog")
 179 
 180         #------------
 181 
 182         self.ShowModal()
 183         self.Destroy()
 184 
 185     #-----------------------------------------------------------------------
 186 
 187     def SetProperties(self):
 188         """
 189         ...
 190         """
 191 
 192         frameicon = wx.Icon("icon_wxWidgets.ico")
 193         self.SetIcon(frameicon)
 194 
 195         self.SetMinSize((420, 550))
 196 
 197 
 198     def CreateCtrls(self):
 199         """
 200         ...
 201         """
 202 
 203         self.firstBox = MyCaptionBox(self, "First caption")
 204 
 205         # Create some static text in the box.
 206         for x in range(4):
 207             st = wx.StaticText(self.firstBox,
 208                                label="- blah, blah, blah, blah... %d" % x)
 209             self.firstBox.AddItem(st)
 210 
 211         #------------
 212 
 213         self.secondBox = MyCaptionBox(self, "Second caption")
 214 
 215         # Create some static text in the box.
 216         for x in range(4):
 217             st = wx.StaticText(self.secondBox,
 218                                label="- blah, blah, blah, blah... %d" % x)
 219             self.secondBox.AddItem(st)
 220 
 221         #------------
 222 
 223         self.thirdBox = MyCaptionBox(self, "Third caption")
 224 
 225         # Create some static text in the box.
 226         for x in range(4):
 227             st = wx.StaticText(self.thirdBox,
 228                                label="- blah, blah, blah, blah... %d" % x)
 229             self.thirdBox.AddItem(st)
 230 
 231         #------------
 232 
 233         self.btnSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
 234 
 235 
 236     def DoLayout(self):
 237         """
 238         ...
 239         """
 240 
 241         mainSizer = wx.BoxSizer(wx.HORIZONTAL)
 242         ctrlSizer = wx.BoxSizer(wx.VERTICAL)
 243 
 244         ctrlSizer.Add(self.firstBox, 1, wx.EXPAND)
 245         ctrlSizer.Add(self.secondBox, 1, wx.EXPAND)
 246         ctrlSizer.Add(self.thirdBox, 1, wx.EXPAND)
 247         ctrlSizer.Add(self.btnSizer, 0, wx.EXPAND |
 248                       wx.RIGHT, 5)
 249 
 250         mainSizer.Add(ctrlSizer, 1, wx.EXPAND |
 251                       wx.BOTTOM, 10)
 252 
 253         self.SetSizer(mainSizer)
 254         mainSizer.Layout()
 255 
 256 #---------------------------------------------------------------------------
 257 
 258 class MyFrame(wx.Frame):
 259     """
 260     ...
 261     """
 262     def __init__(self):
 263         super(MyFrame, self).__init__(None,
 264                                       -1,
 265                                       title="")
 266 
 267         #------------
 268 
 269         # Return application name.
 270         self.app_name = wx.GetApp().GetAppName()
 271 
 272         #------------
 273 
 274         # Simplified init method.
 275         self.SetProperties()
 276         self.CreateCtrls()
 277         self.BindEvents()
 278         self.DoLayout()
 279 
 280         #------------
 281 
 282         self.CenterOnScreen()
 283 
 284     #-----------------------------------------------------------------------
 285 
 286     def SetProperties(self):
 287         """
 288         ...
 289         """
 290 
 291         self.SetTitle(self.app_name)
 292 
 293         #------------
 294 
 295         frameicon = wx.Icon("icon_wxWidgets.ico")
 296         self.SetIcon(frameicon)
 297 
 298 
 299     def CreateCtrls(self):
 300         """
 301         ...
 302         """
 303 
 304         # Create a panel.
 305         self.panel = wx.Panel(self, -1)
 306 
 307         #------------
 308 
 309         # Add some buttons.
 310         self.btnDlg = wx.Button(self.panel,
 311                                 -1,
 312                                 "&Show caption box dialog")
 313 
 314         self.btnClose = wx.Button(self.panel,
 315                                   -1,
 316                                   "&Close")
 317 
 318 
 319     def BindEvents(self):
 320         """
 321         Bind some events to an events handler.
 322         """
 323 
 324         # Bind the close event to an event handler.
 325         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
 326 
 327         # Bind the buttons event to an event handler.
 328         self.Bind(wx.EVT_BUTTON, self.OnSetting, self.btnDlg)
 329         self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.btnClose)
 330 
 331 
 332     def DoLayout(self):
 333         """
 334         ...
 335         """
 336 
 337         # MainSizer is the top-level one that manages everything.
 338         mainSizer = wx.BoxSizer(wx.VERTICAL)
 339 
 340         # wx.BoxSizer(window, proportion, flag, border)
 341         # wx.BoxSizer(sizer, proportion, flag, border)
 342         mainSizer.Add(self.btnDlg, 1, wx.EXPAND | wx.ALL, 10)
 343         mainSizer.Add(self.btnClose, 1, wx.EXPAND | wx.ALL, 10)
 344 
 345         # Finally, tell the panel to use the sizer for layout.
 346         self.panel.SetAutoLayout(True)
 347         self.panel.SetSizer(mainSizer)
 348 
 349         mainSizer.Fit(self.panel)
 350 
 351     #-----------------------------------------------------------------------
 352 
 353     def OnCloseMe(self, event):
 354         """
 355         ...
 356         """
 357 
 358         self.Close(True)
 359 
 360 
 361     def OnSetting(self, event):
 362         """
 363         ...
 364         """
 365 
 366         settingDlg = MyDialog(self,
 367                               title="Caption box dialog")
 368                               #pos=(-1, -1),
 369                               #size=(500, 300))
 370 
 371     def OnCloseWindow(self, event):
 372         """
 373         ...
 374         """
 375 
 376         self.Destroy()
 377 
 378 #---------------------------------------------------------------------------
 379 
 380 class MyApp(wx.App):
 381     """
 382     ...
 383     """
 384     def OnInit(self):
 385 
 386         #------------
 387 
 388         self.SetAppName("Main frame")
 389 
 390         #------------
 391 
 392         self.installDir = os.path.split(os.path.abspath(sys.argv[0]))[0]
 393 
 394         #------------
 395 
 396         frame = MyFrame()
 397         self.SetTopWindow(frame)
 398         frame.Show(True)
 399 
 400         return True
 401 
 402     #-----------------------------------------------------------------------
 403 
 404     def GetInstallDir(self):
 405         """
 406         Returns the installation directory for my application.
 407         """
 408 
 409         return self.installDir
 410 
 411 #---------------------------------------------------------------------------
 412 
 413 def main():
 414     app = MyApp(False)
 415     app.MainLoop()
 416 
 417 #---------------------------------------------------------------------------
 418 
 419 if __name__ == "__main__" :
 420     main()


Download source

source.zip


Additional Information

Link :

- - - - -

https://wiki.wxpython.org/TitleIndex

https://docs.wxpython.org/


Thanks to

Cody Precord, Robin Dunn and the wxPython community...


About this page

Date (d/m/y) Person (bot) Comments :

22/04/18 - Ecco (Created page for wxPython Phoenix).


Comments

- blah, blah, blah...

Customized caption box dialog (Phoenix) (last edited 2019-08-31 13:44:21 by Ecco)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.