Layout a label : Layout « Tk « Ruby






Layout a label


require "tk"

root = TkRoot.new() { title "Today's Date" }
str = Time.now.strftime("Today is \n%B %d, %Y")
lab = TkLabel.new(root) do
        text str
        pack("padx" => 15, "pady" => 10,
             "side" => "top")
      end
Tk.mainloop

 








Related examples in the same category

1.Grid layout manager places its child widgets in a table-like arrangement
2.To understand the use of row and column options
3.Place geometry manager
4.Pack option