12345678910111213141516171819202122232425262728293031323334353637383940 |
- //:w! | !clear && gcc -ltk -ltcl main.c -o template && ./template
- #include "tkc.h"
- int print_hello(TCL_FUNCTION_SIGNITURE)
- {
- tkc_puts("Hello, World!");
- return 0;
- }
- int print_entry_text(TCL_FUNCTION_SIGNITURE)
- {
- tkc_puts(argv[1]);
- return 0;
- }
- int main(void)
- {
- tkc_init();
- tkc_window_("template","200x200","0 0");
- tkc_set_arc_theme();
- tkc_command("on_button_0_pressed", print_hello);
- tkc_command("on_button_1_pressed", print_entry_text);
- TKC_WIDGET
- button_0 = tkc_button("-text {Say hello} -command {on_button_0_pressed}"),
- button_1 = tkc_button("-text {Print entry}"),
- entry_0 = tkc_entry("");
- tkc_configure(button_1, "-command {on_button_1_pressed [%s get]}", entry_0);
- tkc_grid(button_0, 0,0,1,1, "-sticky WE");
- tkc_grid(button_1, 0,1,1,1, "");
- tkc_grid( entry_0, 1,0,2,1, "-sticky WE");
- tkc_mainloop();
- return 0;
- }
|