TK packing

Discussion in 'Ruby' started by Guest, Mar 8, 2006.

  1. Guest

    Guest 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

    --
    Posted via http://www.ruby-forum.com/.
     
    Guest, Mar 8, 2006
    #1
    1. Advertising

  2. From: Guest <>
    Subject: TK packing
    Date: Wed, 8 Mar 2006 12:20:00 +0900
    Message-ID: <>
    > How can I pack this so it looks like this.
    >
    > [New Sprite [-][+][x]]
    > -------------------------
    > | Width: [ ] |
    > | Height: [ ] |
    > - - - - - - - - - - - -


    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)
    ------------------------------------------------------------
    --
    Hidetoshi NAGAI ()
     
    Hidetoshi NAGAI, Mar 8, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy
    Replies:
    0
    Views:
    422
  2. Leandro Pardini

    Binary files, substrings and (un)packing.

    Leandro Pardini, Oct 25, 2003, in forum: Perl
    Replies:
    1
    Views:
    613
    Jim Gibson
    Oct 27, 2003
  3. William Goedicke

    OpenVMS comp-3 packing

    William Goedicke, Jun 28, 2004, in forum: Perl
    Replies:
    0
    Views:
    593
    William Goedicke
    Jun 28, 2004
  4. lynto
    Replies:
    0
    Views:
    412
    lynto
    Jul 27, 2004
  5. Replies:
    0
    Views:
    436
Loading...

Share This Page