#!/usr/bin/env python import wx import empty import wx_ut import base import dbg def get_name(inf): return inf.wxo.o_names.get( inf.o, '?' ) def btn_hdl(inf): tc = inf.wxo.L.tc tc.SetValue( inf.label ) def tbtn_hdl(inf): tc = inf.wxo.L.tc tc.SetValue( '{}={} label={}'.format( get_name( inf ), inf.v, inf.label ) ) def menu_hdl(inf): tc = inf.wxo.L.tc tc.SetValue( '{} {} {} Hz'.format( inf.menu.i, inf.menu.lbl, inf.menu.v ) ) def init(wxo): tc = wxo.wx_new( wx.TextCtrl, '', min_h=80 ) (btn_ok, btn_cancel, btn_go) = wxo.button_new( [ 'OK', 'Cancel', 'Go' ], btn_hdl ) def ckb_hdl(inf): btn_go.Enable( inf.v ) ckb = wxo.checkbox_new( 'enable', ckb_hdl, init_stat=True ) tbtn_1 = wxo.toggle_new( 'ON', tbtn_hdl ) tbtn_2 = wxo.toggle_new( [ 'ON', 'OFF' ], tbtn_hdl ) menu = wxo.menu_new( [ 'MBS', 'ABC', 'OBC' ], menu_hdl, 'ABC', [ 1179, 1008, 1314 ] ) wp = wxo.wp wp_exp = wxo.wp_exp lsts = [ wp_exp( [ wp_exp( tc, prop=1 ) ], prop=1 ), wp_exp( [ tbtn_1, wp( tbtn_2, prop=1 ), 'radio', menu ] ), wp_exp( [ btn_ok, btn_cancel, ckb, wp( btn_go, prop=1 ) ] ), ] wxo.wrap_frame( lsts ) wxo.L = empty.new( locals() ) wxo.o_names = base.rev_dic( locals() ) def run(): wxo = wx_ut.new( 'wx sample 4', init ) wxo.main_loop() if __name__ == "__main__": run() # EOF