
- Ruby - Home
- Ruby - Overview
- Ruby - Environment Setup
- Ruby - Syntax
- Ruby - Classes and Objects
- Ruby - Variables
- Ruby - Operators
- Ruby - Comments
- Ruby - IF...ELSE
- Ruby - Loops
- Ruby - Methods
- Ruby - Blocks
- Ruby - Modules
- Ruby - Strings
- Ruby - Arrays
- Ruby - Hashes
- Ruby - Date & Time
- Ruby - Ranges
- Ruby - Iterators
- Ruby - File I/O
- Ruby - Exceptions
- Ruby - Object Oriented
- Ruby - Regular Expressions
- Ruby - Database Access
- Ruby - Web Applications
- Ruby - Sending Email
- Ruby - Socket Programming
- Ruby - Ruby/XML, XSLT
- Ruby - Web Services
- Ruby - Tk Guide
- Ruby - Ruby/LDAP Tutorial
- Ruby - Multithreading
- Ruby - Built-in Functions
- Ruby - Predefined Variables
- Ruby - Predefined Constants
- Ruby - Associated Tools
- Ruby Useful Resources
- Ruby - Quick Guide
- Ruby - Cheatsheet
- Ruby - Useful Resources
- Ruby - Discussion
- Ruby - Ruby on Rails Tutorial
Ruby/TK - The place geometry manager
Description
The place geometry manager allows you to place a widget at the specified position in the window. You can specify the position either in absolute terms or relative to the parent window or the widget.
To specify an absolute position, use the x and y options. To specify a position relative to the parent window or the widget, use the relx and rely options.
In addition, you can specify the relative size of the widget by using the relwidth and relheight options provided by this geometry manager.
Syntax
Here is a simple syntax to create a place Widget −
place(relx'=>x, 'rely'=>y)
Examples
Following is the code which implements the place geometry manager −
require 'tk' top = TkRoot.new {title "Label and Entry Widget"} #code to add a label widget lb1 = TkLabel.new(top){ text 'Hello World' background "yellow" foreground "blue" place('relx'=>0.0,'rely'=>0.0) } #code to add a entry widget e1 = TkEntry.new(top){ background "red" foreground "blue" place('relx'=>0.4,'rely'=>0.0) } Tk.mainloop
This will produce the following result −

ruby_tk_guide.htm
Advertisements