-1

I was wondering if itcl is supported by python, cause it seems to be a part of the tcl/tk lib. And while I have not found out where the widgets in cpython actually gets created, I guess it should be somewhat itcl. So my attempt was a copy of this in the documentation.

import tkinter as tk

root = tk.Tk()
root.tk.eval('''
    itcl::widget Foo {
    protected common boolean
    set boolean(true) 1
    set boolean(false) 0
}''')

But failed with _tkinter.TclError: invalid command name "itcl::widget"

mrcalvin
  • 3,291
  • 12
  • 18
Thingamabobs
  • 7,274
  • 5
  • 21
  • 54
  • 2
    I'd guess you should put `package require Itcl` inside that script before using the `itcl::widget` command. Yes, the capitalisation is inconsistent; we'd twist arms to get that fixed if it wasn't so likely to break user code. That might still fail, but then it will fail in a useful way. – Donal Fellows Oct 12 '22 at 08:29

1 Answers1

1

I am almost positive that Itcl is not supported by python, although it can be created. Here it is for C -> https://github.com/tcltk/itcl

Kai
  • 18
  • 4
  • Thanks for your response, it seems convenient while its an entire different package on github. But I'm still unsure because I don't understand where these widgets come from. As an [example](https://github.com/tcltk/tk/blob/main/library/listbox.tcl), all I see is [`tk::Priv`](https://wiki.tcl-lang.org/page/tk%3A%3APriv) but ok, it still uses `tk` as primary command but is still [undocumented](https://www.tcl.tk/man/tcl/TkCmd/contents.html). – Thingamabobs Oct 11 '22 at 21:07
  • `tk::Priv` is a variable, and it holds working state for Tk's scripted event handlers. It's undocumented because you shouldn't ever be playing around with it yourself. (It's name has changed in the past without announcement.) – Donal Fellows Oct 12 '22 at 08:26