Multiple Tk Windows

C

csjasnoch

I can't find much on this but is there a simple way to initiate 2
windows?

I really wouldnt even care if the one had to get killed but I would
like it if both could run, and one being a conditional on the other
window activating some variable.
 
G

gregarican

I can't find much on this but is there a simple way to initiate 2
windows?


I really wouldnt even care if the one had to get killed but I would
like it if both could run, and one being a conditional on the other
window activating some variable.

Check out the method to create a new top level window:

the_root = TkRoot.new()
new_window=TkTopLevel.new(the_root)

You can toggle between things using methods like:

the_root.withdraw # to hide the window
the_root.deiconify # to show the window

Does this help some?
 
C

csjasnoch

It seems TkTopLevel is not recognized:(

And how would it coincide with Tk.mainloop() ?
I tried this just to see what would happen but as I said TkTopLevel was
not recognized...

require 'tk'


the_root = TkRoot.new()
new_window= TkTopLevel.new(the_root)

Tk.mainloop()


I think what you are saying is I should be able to create multiple
roots and toggle them in and out.. however multiple roots seem to be
the same window, thus I am guessing this is thwat TkTopLevel is for.
But it says

uninitialized constant TkTopLevel (NameError)
 
G

gregarican

I tried this just to see what would happen but as I said TkTopLevel was
not recognized...

Oops. Sorry for the typo. It's TkToplevel _not_ TkTopLevel. Try that
and you're set.
 
C

csjasnoch

to gregarcian-

Yes I found that site also. It is usefull for tell what methods there
are. But gives little for their usages and what the parameters should
be...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,503
Latest member
supremedee

Latest Threads

Top