TkRoot.new :width => 4, :height => 2

A

Ara.T.Howard

can someone please tell me why the following does NOT produce a window half as
big as my screen?


require 'tk'

tkroot = TkRoot.new

width = (tkroot.winfo_screenwidth * 0.5).to_i
height = (tkroot.winfo_screenheight * 0.5).to_i

tklabel = TkLabel.new :text => 'foobar'
tklabel.pack :expand => true, :fill => 'both'

tkroot.configure :width => width, :height => height

Tk.mainloop


a similar approach works fine with 'place' instead of pack. i tried
':pack_propagate => false' in the call to 'TkRoot.new' - but that didn't work
either...

-a
--

ATTN: please update your address books with address below!

===============================================================================
| EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
| PHONE :: 303.497.6469
| ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
| STP :: http://www.ngdc.noaa.gov/stp/
| NGDC :: http://www.ngdc.noaa.gov/
| NESDIS :: http://www.nesdis.noaa.gov/
| NOAA :: http://www.noaa.gov/
| US DOC :: http://www.commerce.gov/
|
| The difference between art and science is that science is what we
| understand well enough to explain to a computer.
| Art is everything else.
| -- Donald Knuth, "Discover"
|
| /bin/sh -c 'for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done'
===============================================================================
 
F

Ferenc Engard

Hello,

Ara.T.Howard said:
can someone please tell me why the following does NOT produce a window half as
big as my screen?

require 'tk'

tkroot = TkRoot.new

width = (tkroot.winfo_screenwidth * 0.5).to_i
height = (tkroot.winfo_screenheight * 0.5).to_i

tklabel = TkLabel.new :text => 'foobar'
tklabel.pack :expand => true, :fill => 'both'

tkroot.configure :width => width, :height => height

Tk.mainloop

a similar approach works fine with 'place' instead of pack. i tried
':pack_propagate => false' in the call to 'TkRoot.new' - but that didn't work
either...

Try ':pack_propagate => 0'.

Ferenc
 

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

Similar Threads

tk file dialog and directories 3
puts(derived_from_array) 0
make MISSING=flock.o 0
[RCR] Kernel#hostname 0
io/nonblock 4
tkscrollframe.rb 1
pp equiv of #inspect 1
[BUG] greedy gsub 1

Members online

No members online now.

Forum statistics

Threads
473,785
Messages
2,569,624
Members
45,319
Latest member
LorenFlann

Latest Threads

Top