WPF Application
import wpf
def app_table():
def table_handler(s,e):
row = s.SelectedItem
print( row['1st'], row['2nd'], row['3rd'] )
def print_handler(s,e):
rows = table_ctrl.get_selected_items()
for row in rows:
print(row['1st'], row['2nd'], row['3rd'])
def add_handler(s,e):
table_ctrl.add_item( ( "aaa1", "aaa2", "aaa3" ) )
table_ctrl.add_item( {"2nd": "bbb2","3rd":"bbb3","1st":"bbb1"} )
table_ctrl.add_item( ( "ccc1", "ccc2", "ccc3" ) )
def clear_handler(s,e):
table_ctrl.clear()
app = wpf.Win("Button Demo",320,240)
table_ctrl = wpf.WpfTable(columns=("1st","2nd","3rd"),
widths=(50,150,120),
handler=table_handler)
table_ctrl.add_item( ( "aaa1", "aaa2", "aaa3" ) )
table_ctrl.add_item( {"2nd": "bbb2","3rd":"bbb3","1st":"bbb1"} )
table_ctrl.add_item( ( "ccc1", "ccc2", "ccc3" ) )
hb = wpf.WpfHBox()
hb.add_spacer()
hb.add_button( "Add", add_handler )
hb.add_button( "Clear", clear_handler )
vb = wpf.WpfVBox()
vb.add_item( table_ctrl.ctrl, expand=True )
vb.add_item( hb.ctrl )
app.set_content( vb.ctrl)
sb = wpf.WpfStatusBar()
sb.add_label( "Ready" )
app.add_statusbar(sb.ctrl)
app.run()
if __name__ == "__main__":
app_table()
댓글 없음:
댓글 쓰기