I have a Mac OS X system. I wrote a Ruby program that uses RubyTk to
display a TkLabel. It works, but I’d like a bit more control over how
it looks. Here’s the code minus the non-Tk stuff that isn’t relevant
to my questions:
require ‘tk’
answer = ‘test’
TkLabel.new do
text answer
foreground ‘yellow’
background ‘black’
place(‘x’ => 400, ‘y’ = 400)
pack(‘padx’ => 15, ‘pady’ => 15)
end
def timer_loop3
exit
end
TkAfter.new(3000, # milliseconds
-1, # ?
proc{timer_loop3} # what to call when the timer expires
).start
Tk.mainloop
The program displays a label for 3 seconds and exits, as intended,
but…
- How do I control the placement of the label on the screen? It now
apppears
near the upper left-hand corner. I tried “place” (commented out)
with no
luck. - How can I make the label appear on top of other windows? It naw
appears
“under” other windows, so I only see the label if I keep the
upper-left part
of my screen free of other windows. - Is there a way to remove the borders? I don’t need the title bar.
- I use this as a Mac OS X service, dufined with ThisService, a great
little
program. When I run it as a service, two windows appear. One is
titled “tk”
and the other is the same as what I see when I run the program from
the
command line. Can I get rid of the “tk” window? - Of course, is there a better way to do this?
– Pete