Copyright © tutorialspoint.com
A Combobox combines an entry with a list of choices available to the user. This lets them either choose from a set of values you've provided (e.g. typical settings), but also put in their own value.
Here is a simple syntax to create this widget:
Tk::BWidget::ComboBox.new(root){ .....Options.... } |
Combobox combines the options related to TkEntry and TkListbox widgets.
Combobox inherits event bindings from TkEntry and TkListbox widgets.
require 'tk' require 'tkextlib/bwidget' root = TkRoot.new root.title = "Window" combobox = Tk::BWidget::ComboBox.new(root) combobox.values = [1, 2, 3, 4] combobox.place('height' => 25, 'width' => 100, 'x' => 10, 'y' => 10) Tk.mainloop |
This will produce following result
Copyright © tutorialspoint.com