Module: SimpleTk
- Defined in:
- lib/simple_tk.rb,
lib/simple_tk/errors.rb,
lib/simple_tk/window.rb,
lib/simple_tk/version.rb,
lib/simple_tk/get_set_helper.rb,
lib/simple_tk/widget_helpers.rb
Overview
A real cheap wrapper around the Ruby Tk bindings.
Defined Under Namespace
Modules: DisableHelpers Classes: DuplicateNameError, GetSetHelper, SimpleTkError, Window
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.alert(message, icon = :info) ⇒ Object
Creates a basic alert message box.
-
.ask(message, icon = :question, ok_cancel = false) ⇒ Object
Creates a basic yes/no message box.
-
.run ⇒ Object
Runs the Tk application.
Class Method Details
.alert(message, icon = :info) ⇒ Object
Creates a basic alert message box.
- message
-
The message to display.
- icon
-
The icon to display (one of :info, :error, :question, or :warning).
Returns true.
24 25 26 27 |
# File 'lib/simple_tk.rb', line 24 def self.alert(, icon = :info) Tk:: message: , icon: icon.to_s true end |
.ask(message, icon = :question, ok_cancel = false) ⇒ Object
Creates a basic yes/no message box.
- message
-
The message to display.
- icon
-
The icon to display (one of :info, :error, :question, or :warning).
- ok_cancel
-
Set to true to make the buttons OK and Cancel instead of Yes and No.
Returns true for ‘Yes’ (or ‘OK’) or false for ‘No’ (or ‘Cancel’).
40 41 42 |
# File 'lib/simple_tk.rb', line 40 def self.ask(, icon = :question, ok_cancel = false) %w(ok yes).include?(Tk::(message: , type: ok_cancel ? 'okcancel' : 'yesno', icon: icon)) end |
.run ⇒ Object
Runs the Tk application.
11 12 13 |
# File 'lib/simple_tk.rb', line 11 def self.run Tk.mainloop end |