Posted to tcl by starseeker at Sat Apr 25 14:05:49 GMT 2020view raw
- #include "stdlib.h"
- #include "tcl.h"
- #include "tk.h"
- #define wsize 500
- int
- main()
- {
- Tcl_Interp *interp = Tcl_CreateInterp();
- Tk_Init(interp);
- Tk_Window tkwin = Tk_MainWindow(interp);
- Tk_GeometryRequest(tkwin, wsize, wsize);
- Tk_MakeWindowExist(tkwin);
- Tk_MapWindow(tkwin);
- Tcl_Eval(interp, "bind . <Button-1> \"puts A\"");
- Tcl_Eval(interp, "event generate . <Button-1>");
- while (1) {
- int handled = 0;
- while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT)) {
- handled++;
- }
- if (!Tk_GetNumMainWindows()) {
- exit(0);
- }
- }
- }
- Error:
- A
- invalid command name "::tk::ScreenChanged"
- while executing
- "::tk::ScreenChanged :1.0"
- (changing screen in event binding)
Comments
Posted by starseeker at Sat Apr 25 14:27:24 GMT 2020 [text] [code]
Problem turned out to be Tcl_Init not getting called - added before Tk_Init and it cleared the error.