fsleyes_widgets.numberdialog

This module provides the NumberDialog class, a dialog which allows the user to enter a number.

class fsleyes_widgets.numberdialog.NumberDialog(parent, real=True, title=None, message=None, initial=None, minValue=None, maxValue=None, okText=None, cancelText=None)[source]

Bases: Dialog

A wx.Dialog which prompts the user for a number.

This class differs from the wx.NumberEntryDialog in that it supports floating point numbers.

A NumberDialog contains a wx.FloatSpinCtrl and Ok/Cancel buttons, allowing the user to specify a number. If the user pushes the Ok button, the number they entered will be accessible via the GetValue() method.

Create a NumberDialog.

Parameters:
  • parent – The wx parent object.

  • real – If True, a floating point number will be accepted. Otherwise, only integers are accepted.

  • title – Dialog title.

  • message – If not None, a wx.StaticText label is added, containing the message.

  • initial – Initial value.

  • minValue – Minimum value.

  • maxValue – Maximum value.

  • okText – Text for OK button. Defaults to “Ok”.

  • cancelText – Text for Cancel button. Defaults to “Cancel”

property floatSpinCtrl

Returns a reference to the FloatSpinCtrl.

property okButton

Returns a reference to the ok Button.

property cancelButton

Returns a reference to the cancel Button.

GetValue()[source]

Return the value that the user entered.

After a valid value has been entered, and OK button pushed (or enter pressed), this method may be used to retrieve the value. Returns None in all other situations.