Calling namespaced Tk command from Ruby-Tk/8.6

I am having difficulty calling various Tk extension packages from Ruby-Tk. As an example, I have a package called "windowlist," which is correctly loaded with this call:

TkPackage.require('windowlist')

Later, when I call a Tk command from this library, I get a runtime error, "invalid command name." Here is the call:

  Tk.tk_call("windowlist::windowMenu", $menubar)

The package has been successfully loaded via the "package require" bits above, so it is not clear to me why this command fails. Similar calls in Python and Perl work just fine. Does Ruby-Tk require some kind of wrapper function to call namespaced Tcl commands?

I am using Tk 8.6.6 and ruby 2.3.1p112.

--Kevin

···

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com

Turns out it was a scoping issue...once I moved the TkPackage.require call to the toplevel scope, things worked fine.

--Kevin

···

On 6/7/17 10:44 PM, Kevin Walzer wrote:

I am having difficulty calling various Tk extension packages from Ruby-Tk. As an example, I have a package called "windowlist," which is correctly loaded with this call:

TkPackage.require('windowlist')

Later, when I call a Tk command from this library, I get a runtime error, "invalid command name." Here is the call:

Tk.tk_call("windowlist::windowMenu", $menubar)

The package has been successfully loaded via the "package require" bits above, so it is not clear to me why this command fails. Similar calls in Python and Perl work just fine. Does Ruby-Tk require some kind of wrapper function to call namespaced Tcl commands?

I am using Tk 8.6.6 and ruby 2.3.1p112.

--Kevin

--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com