self.nb.add_page(self.details_panel, 'Device details') attrs = get_printer_attrs(default) self.attrs_panel = AttrsPanel(self.nb, attrs) self.nb.add_page(self.attrs_panel, 'Device attributes') options = get_printer_options(default) self.options_panel = OptionPanel(self.nb, options) self.nb.add_page(self.options_panel, 'Device options') self.pack(self.nb, fill=True, expand=True, padding_all=10) def printer_changed(self, *args): if not self.attrs_panel:return details = self.prn_dict[self.prn_combo.get_active_value()] self.details_panel.set_prn_details(details) attrs = get_printer_attrs(self.prn_combo.get_active_value()) self.attrs_panel.set_prn_attrs(attrs) options = get_printer_options(self.prn_combo.get_active_value()) self.options_panel.set_prn_options(options) app = wal.Application('wxWidgets') mw = wal.MainWindow('CUPS printers', (750, 450)) top_panel = TestPanel(mw) mw.pack(top_panel, expand=True, fill=True) app.mw = mw app.run()
import wal class WidgetPanel(wal.HPanel): def __init__(self, parent): wal.HPanel.__init__(self, parent) self.win = wal.ScrolledPanel(self, border=True) # self.win.set_virtual_size((160, 1600)) self.win.set_bg(wal.WHITE) self.pack(self.win, expand=True, fill=True, padding_all=10) def selected(self, item): print item def activated(self, item): print item app = wal.Application('wxWidgets') mw = wal.MainWindow('ScrolledPanel widget', (250, 350)) panel = WidgetPanel(mw) mw.pack(panel, expand=True, fill=True, padding=10) app.mw = mw app.run()
import wal class WidgetPanel(wal.HPanel): def __init__(self, parent): wal.HPanel.__init__(self, parent) panel = wal.LabeledPanel(self, text='LabeledPanel') self.pack(panel, fill=True, expand=True, padding_all=10) panel.pack(wal.Label(panel, 'Internal widget')) app = wal.Application('wxWidgets') mw = wal.MainWindow('LabeledPanel widget', (250, 350)) panel = WidgetPanel(mw) mw.pack(panel, expand=True, fill=True, padding=10) app.mw = mw app.run()
self.pack(exp, fill=True) exp.pack(wal.Button(exp, 'Test button')) data = [] root = wal.TreeElement('root') prov = wx.ArtProvider_GetBitmap icon = prov(wx.ART_CDROM, wx.ART_OTHER, wal.SIZE_16) root.icon = icon for item in range(5): el = wal.TreeElement('Element %d' % item) root.childs.append(el) data.append(root) data.append(root) self.tree = wal.TreeWidget(self, data, on_select=self.selected) self.pack(self.tree, expand=True, fill=True, padding=2) self.tree.expand_all() def selected(self, item): print item app = wal.Application('wxWidgets') mw = wal.MainWindow('Tree widget', (350, 550)) top_panel = wal.VPanel(mw) mw.pack(top_panel, expand=True, fill=True) panel = WidgetPanel(top_panel) top_panel.pack(panel, expand=True, fill=True, padding_all=5) app.mw = mw app.run()
# The test should show main window which is: # 1)maximized # 2)centered after demaximizing # 3)has size 1000x500 # 4)has minimal size 500x500 # 5)has title "Test 02" import wal mw = wal.MainWindow() mw.set_title("Test 02") mw.set_minsize((500, 500)) mw.set_size((1000, 700)) mw.center() mw.maximize() mw.run()
os.environ["MAGICK_CONFIGURE_PATH"] = magickdir os.environ["MAGICK_HOME"] = magickdir os.chdir(os.path.join(devres, 'dlls')) import wal class ColorPanel(wal.ScrolledPanel): def __init__(self, parent): wal.ScrolledPanel.__init__(self, parent) keys = wal.UI_COLORS.keys() grid = wal.GridPanel(self, len(keys), 2, 10, 10) for item in keys: grid.pack(wal.Label(grid, item)) panel = wal.VPanel(grid) panel.pack((80, 50)) panel.set_bg(wal.UI_COLORS[item]) grid.pack(panel) self.pack(grid, padding=10) app = wal.Application('wxWidgets') mw = wal.MainWindow('WAL colors', (350, 550)) top_panel = wal.VPanel(mw) mw.pack(top_panel, expand=True, fill=True) panel = ColorPanel(top_panel) top_panel.pack(panel, expand=True, fill=True) app.mw = mw app.run()
class WidgetPanel(wal.HPanel): def __init__(self, parent): wal.HPanel.__init__(self, parent) pnl = wal.VPanel(self, border=True) self.lst = wal.LayerList(pnl, TEST_LIST, BITMAPS, on_change=self.changes) pnl.pack(self.lst, fill=True, expand=True) self.pack(pnl, padding_all=10, fill=True, expand=True) def changes(self, item, column): if column < 4: if not column: for line in TEST_LIST: line[0] = 0 TEST_LIST[item][0] = 1 else: TEST_LIST[item][column] = abs(TEST_LIST[item][column] - 1) self.lst.update(TEST_LIST) app = wal.Application('wxWidgets') mw = wal.MainWindow('LayerList widget', (210, 300)) panel = WidgetPanel(mw) mw.pack(panel, expand=True, fill=True, padding=10) app.mw = mw app.run()
'even', 'odd', '3dlight', ] class ColorPanel(wal.ScrolledPanel): def __init__(self, parent): wal.ScrolledPanel.__init__(self, parent) grid = wal.GridPanel(self, len(COLORS), 2, 10, 10) for item in COLORS: grid.pack(wal.Label(grid, item)) panel = wal.VPanel(grid) panel.set_bg(wal.BLACK) color_panel = wal.VPanel(panel) color_panel.pack((80, 30)) color_panel.set_bg(wal.UI_COLORS[item]) panel.pack(color_panel, padding_all=1) grid.pack(panel) self.pack(grid, padding=10) app = wal.Application('wxWidgets') mw = wal.MainWindow(app, 'WAL colors', (350, 650)) top_panel = wal.VPanel(mw) mw.pack(top_panel, expand=True, fill=True) panel = ColorPanel(top_panel) top_panel.pack(panel, expand=True, fill=True) app.mw = mw app.run()
# The test should show main window. import wal wal.MainWindow().run()
def __init__(self, parent): wal.HPanel.__init__(self, parent) self.slist = wal.SimpleList(self, TESTLIST, on_select=self.selected, on_activate=self.activated) self.pack(self.slist, expand=True, fill=True, padding=10) self.report = wal.ReportList(self, TESTMULTILIST, on_select=self.selected, on_activate=self.activated) self.pack(self.report, expand=True, fill=True, padding=10) def selected(self, item): print item def activated(self, item): print item app = wal.Application('wxWidgets') mw = wal.MainWindow('List widget', (750, 550)) top_panel = wal.VPanel(mw) mw.pack(top_panel, expand=True, fill=True) panel = WidgetPanel(top_panel) top_panel.pack(panel, expand=True, fill=True, padding=10) app.mw = mw app.run()
} class ColorPanel(wal.ScrolledPanel): def __init__(self, parent): wal.ScrolledPanel.__init__(self, parent) keys = WX_COLORS.keys() keys.sort() grid = wal.GridPanel(self, len(keys), 2, 10, 10) for item in keys: grid.pack(wal.Label(grid, item)) panel = wal.VPanel(grid) panel.set_bg(wal.BLACK) color_panel = wal.VPanel(panel) color_panel.pack((80, 30)) color_panel.set_bg(wx.SystemSettings.GetColour(WX_COLORS[item]).Get() if wal.IS_WX4 else wx.SystemSettings_GetColour(WX_COLORS[item]).Get()) panel.pack(color_panel, padding_all=1) grid.pack(panel) self.pack(grid, padding=10) app = wal.Application('wxWidgets') mw = wal.MainWindow(app, 'wxpython colors', (450, 550)) top_panel = wal.VPanel(mw) mw.pack(top_panel, expand=True, fill=True) panel = ColorPanel(top_panel) top_panel.pack(panel, expand=True, fill=True) app.mw = mw app.run()