OK and Cancel buttons

598 views
Skip to first unread message

Phil Rich

unread,
Apr 11, 2014, 2:37:20 PM4/11/14
to npys...@googlegroups.com
What determines the location of the default Cancel and OK buttons?
I see they show up in some of your examples, but I don't see where they are defined.

Can I move them or write my own handlers for them?
Or can they be eliminated altogether and be  replaced by my own widgets?

Thanks!

Nicholas Cole

unread,
Apr 11, 2014, 4:40:35 PM4/11/14
to npys...@googlegroups.com
Hi Phil,

I assume you mean on the "Action" forms.

In terms of handlers, on those forms writing your own handlers is as simple as defining your own methods

on_ok
on_cancel

on a subclass of the form.

The names and positions of the buttons are controlled by class attributes. I'll send a full list when I'm next at the computer. 
--
You received this message because you are subscribed to the Google Groups "npyscreen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to npyscreen+...@googlegroups.com.
To post to this group, send email to npys...@googlegroups.com.
Visit this group at http://groups.google.com/group/npyscreen.
For more options, visit https://groups.google.com/d/optout.

Nicholas Cole

unread,
Apr 12, 2014, 9:31:29 AM4/12/14
to npys...@googlegroups.com
Phil,

Here are the class variables you might want to change in subclasses:


BLANK_COLUMNS_RIGHT= 2
BLANK_LINES_BASE = 2
OK_BUTTON_TEXT = 'OK'
OK_BUTTON_BR_OFFSET = (2,6)
OKBUTTON_TYPE = button.MiniButton
DEFAULT_X_OFFSET = 2
CANCEL_BUTTON_BR_OFFSET = (2, 12)
CANCEL_BUTTON_TEXT = "Cancel"
Reply all
Reply to author
Forward
0 new messages