-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
37 lines (36 loc) · 956 Bytes
/
test.cpp
File metadata and controls
37 lines (36 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <ctime>
#include <Tki.hpp>
int main() {
tki::TkApp tkapp;
{
tki::Func f = [&] TKIL {
if (args.size() != 3) {
TKI_THROW(&tkapp,
"wrong # args: should be \"" + args[0].str() + " numberA number B\"");
return {};
}
return { args[1].str() + args[2].str() };
};
tki::Object connect = f;
tki::Tk t((tki::Misc*)&tkapp);
struct STRUCT { tki::TkApp* tkapp; };
STRUCT cd;
cd.tkapp = &tkapp;
Tcl_ThreadId thri;
Tcl_CreateThread(&thri, [](ClientData _cd)->unsigned {
STRUCT* cd = (STRUCT*)_cd;
tki::TkApp& tkapp = *(cd->tkapp);
tkapp.call({ "font","create","font1","-family","Unifont" });
tkapp.call({ "ttk::label",".a","-font","font1" });
tkapp.call({ "pack",".a" });
size_t start = time(NULL);
for (;;) {
tkapp.call({ ".a","config","-text", time(NULL)-start });
Tcl_Sleep(10);
}
return 0;
}, &cd, TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS);
Tk_MainLoop();
}
return 0;
}