TK packing

G

Guest

How can I pack this so it looks like this.

[New Sprite [-][+][x]]
-------------------------
| Width: [ ] |
| Height: [ ] |
- - - - - - - - - - - -

dialogBox = TkToplevel.new('title'=>'New Sprite')
frame = TkFrame.new(dialogBox).pack('fill'=>'both')

widthLabel = TkLabel.new(frame, 'text'=>'Width: ')
widthEntry = TkEntry.new(frame)
widthEntry.value = 32
heightLabel = TkLabel.new(frame, 'text'=>'Height: ')
heightEntry = TkEntry.new(frame)
heightEntry.value = 32
 
H

Hidetoshi NAGAI

From: Guest <[email protected]>
Subject: TK packing
Date: Wed, 8 Mar 2006 12:20:00 +0900
Message-ID: said:
How can I pack this so it looks like this.

[New Sprite [-][+][x]]

Please read a Tcl/Tk's document about the rule of 'pack' geometry
manager or 'grid' geometry manager.
dialogBox = TkToplevel.new('title'=>'New Sprite')
frame = TkFrame.new(dialogBox).pack('fill'=>'both')

widthLabel = TkLabel.new(frame, 'text'=>'Width: ')
widthEntry = TkEntry.new(frame)
widthEntry.value = 32
heightLabel = TkLabel.new(frame, 'text'=>'Height: ')
heightEntry = TkEntry.new(frame)
heightEntry.value = 32

--------< example 1 >---------------------------------------
dialogBox = TkToplevel.new:)title=>'New Sprite')
frame = TkFrame.new(dialogBox).pack:)fill=>'both')

f_width = TkFrame.new(frame).pack
widthLabel = TkLabel.new(f_width, :text=>'Width: ').pack:)side=>:left)
widthEntry = TkEntry.new(f_width).pack:)side=>:left)
widthEntry.value = 32

f_height = TkFrame.new(frame).pack
heightLabel = TkLabel.new(f_height, :text=>'Height: ').pack:)side=>:left)
heightEntry = TkEntry.new(f_height).pack:)side=>:left)
heightEntry.value = 32
------------------------------------------------------------

--------< example 2 >---------------------------------------
dialogBox = TkToplevel.new:)title=>'New Sprite')
frame = TkFrame.new(dialogBox).pack:)fill=>'both')

widthLabel = TkLabel.new(frame, :text=>'Width: ')
widthEntry = TkEntry.new(frame)
widthEntry.value = 32
Tk.grid(widthLabel, widthEntry)

heightLabel = TkLabel.new(frame, :text=>'Height: ')
heightEntry = TkEntry.new(frame)
heightEntry.value = 32
Tk.grid(heightLabel, heightEntry)
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top