Skip to content

Error in 'tkextlib/tcllib/tooltip' #86

Description

@s7pdragon

I'm tryng to add a tooltip to widgets. but, I get an error when loading the library.

C:/usr/Ruby/lib/ruby/gems/4.0.0/gems/tk-0.6.0/lib/tkextlib/tcllib/tooltip.rb:38:in '<module:Tooltip>': uninitialized constant Tk::Tcllib::Tooltip::WidgetClassNames (NameError)

  WidgetClassNames[WidgetClassName] ||= self
  ^^^^^^^^^^^^^^^^
        from C:/usr/Ruby/lib/ruby/gems/4.0.0/gems/tk-0.6.0/lib/tkextlib/tcllib/tooltip.rb:34:in '<top (required)>'
        from tootip_test.rb:6:in 'Kernel#require'
        from tootip_test.rb:6:in '<main>'

'tooltip_test.rb' is below

require 'tk'
require 'tkextlib/tcllib/tooltip'

root = TkRoot.new { title "Tooltip Test" }

button = TkButton.new(root) {
  text "Hover me"
  pack('padx'=>20, 'pady'=>20)
}

Tk::Tcllib::Tooltip.register(button, "Tip help here.")

Tk.mainloop

' WidgetClassNames' in 'tooltip.rb'

module Tk::Tcllib::Tooltip
extend TkCore
WidgetClassName = 'Tooltip'.freeze
WidgetClassNames[WidgetClassName] ||= self
def self.database_classname
self::WidgetClassName
end
def self.database_class
WidgetClassNames[self::WidgetClassName]
end

the 'WidgetClassNames' seems to be a constat of 'TkCore' ?

Experimentally. I modified ' WidgetClassNames' to 'TkCore::'WidgetClassNames' , and It seems to be going well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions