Version 1 of TclOO Help

Updated 2011-12-26 21:29:35 by Siqsuruq

Hi, I just started to learn tcl and TclOO, so i need some help with my class. I want to run method Print for my object, when i press button, how can i do it?

Here is example

package require Tk oo::class create test {

        constructor {} {
                my gui
        }

        method gui {} {
                pack [frame .main -bg green] -fill both -padx 2 -pady 2 -expand yes -side left -anchor ne
                pack [button .b -text "test" -relief flat -command [??????????]] -side left -padx 2 -pady 2
        }
        method Print {} {
                puts "ola"
        }

}

set c test new

I can do it like this, but in this case method print is public:

package require Tk oo::class create test {

        constructor {} {
                my gui
        }

        method gui {} {
                pack [frame .main -bg green] -fill both -padx 2 -pady 2 -expand yes -side left -anchor ne
                pack [button .b -text "test" -relief flat -command "[self] print"] -side left -padx 2 -pady 2
        }
        method print {} {
                puts "ola"
        }

}

set c test new

Thank you