Window

class rumps.Window(message='', title='', default_text='', ok=None, cancel=None, dimensions=(320, 160))

Generate a window to consume user input in the form of both text and button clicked.

Changed in version 0.2.0: Providing a cancel string will set the button text rather than only using text “Cancel”. message is no longer a required parameter.

Parameters:
  • message – the text positioned below the title in smaller font. If not a string, will use the string representation of the object.
  • title – the text positioned at the top of the window in larger font. If not a string, will use the string representation of the object.
  • default_text – the text within the editable textbox. If not a string, will use the string representation of the object.
  • ok – the text for the “ok” button. Must be either a string or None. If None, a default localized button title will be used.
  • cancel – the text for the “cancel” button. If a string, the button will have that text. If cancel evaluates to True, will create a button with text “Cancel”. Otherwise, this button will not be created.
  • dimensions – the size of the editable textbox. Must be sequence with a length of 2.
add_button(name)

Create a new button.

Changed in version 0.2.0: The name parameter is required to be a string.

Parameters:name – the text for a new button. Must be a string.
add_buttons(iterable=None, *args)

Create multiple new buttons.

Changed in version 0.2.0: Since each element is passed to rumps.Window.add_button(), they must be strings.

default_text

The text within the editable textbox. An example would be

“Type your message here.”

If not a string, will use the string representation of the object.

icon

The path to an image displayed for this window. If set to None, will default to the icon for the application using rumps.App.icon.

Changed in version 0.2.0: If the icon is set to an image then changed to None, it will correctly be changed to the application icon.

message

The text positioned below the title in smaller font. If not a string, will use the string representation of the object.

run()

Launch the window. rumps.Window instances can be reused to retrieve user input as many times as needed.

Returns:a rumps.rumps.Response object that contains the text and the button clicked as an integer.
title

The text positioned at the top of the window in larger font. If not a string, will use the string representation of the object.