This module provides the InspectableApp
and
InspectionMixin
which make it easy to use the Widget
Inspection Tool (WIT).
The Widget Inspection Tool (WIT) is very useful debugging tool provided with
wxPython, especially useful to debug layout issues when using wx.Sizer
.
The InspectableApp
is a “pre-mixed” App
and the
InspectionMixin
allows you to mix it with your custom App
class.
The following samples assume the default key sequence (ctrl-alt-i) to start the WIT, additional information can be found on the following wiki page.
http://wiki.wxpython.org/Widget_Inspection_Tool
InspectableApp usage:
import wx
import wx.lib.sized_controls as sc
import wx.lib.mixins.inspection as wit
app = wit.InspectableApp()
frame = sc.SizedFrame(None, -1, "WIT InspectableApp")
pane = frame.GetContentsPane()
pane.SetSizerType("horizontal")
b1 = wx.Button(pane, wx.ID_ANY)
t1 = wx.TextCtrl(pane, -1)
t1.SetSizerProps(expand=True)
frame.Show()
app.MainLoop()
InspectionMixin usage:
import wx
import wx.lib.sized_controls as sc
import wx.lib.mixins.inspection as wit
class MyApp(wx.App, wit.InspectionMixin):
def OnInit(self):
self.Init() # initialize the inspection tool
return ``True``
app = MyApp()
frame = sc.SizedFrame(None, -1, "WIT InspectionMixin")
pane = frame.GetContentsPane()
pane.SetSizerType("horizontal")
b1 = wx.Button(pane, wx.ID_ANY)
t1 = wx.TextCtrl(pane, -1)
t1.SetSizerProps(expand=True)
frame.Show()
app.MainLoop()
InspectableApp |
A simple mix of App and InspectionMixin that can be used |
InspectionMixin |
This class is intended to be used as a mix-in with the App . |