Simple windowed application
Simple windowed application
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
This tasks asks to create a window with a label that says "There have been no clicks yet" and a button that says "click me". Upon clicking the button with the mouse, the label should change and show the number of times the button has been clicked.
IDL
pro counter, ev widget_control, ev.top, get_uvalue=tst tst[1] = tst[1]+1 widget_control, tst[0], set_value="Number of clicks: "+string(tst[1],format='(i0)') widget_control, ev.top, set_uvalue=tst end id = widget_base(title = 'Window Title',column=1) ld = widget_label(id, value = 'There have been no clicks yet.') widget_control, /realize, id, set_uvalue=[ld,0] dummy = widget_button(id,value=' Click Me ',event_pro='counter') xmanager, "Simple", Id end
Tcl
pack [label .l -text "There have been no clicks yet."] set count 0 pack [button .b -text " Click Me " -command upd] proc upd {} {.l configure -text "Number of clicks: [incr ::count]."}