pyworkflow.gui.widgets module

Some basic GUI widgets are implemented in this module. The widgets here are suppose to be used to build more complex elements.

class pyworkflow.gui.widgets.AutoScrollbar(master=None, cnf={}, **kw)[source]

Bases: Scrollbar

“A scrollbar that hides itself if it’s not needed.

Construct a scrollbar widget with the parent MASTER.

Valid resource names: activebackground, activerelief, background, bd, bg, borderwidth, command, cursor, elementborderwidth, highlightbackground, highlightcolor, highlightthickness, jump, orient, relief, repeatdelay, repeatinterval, takefocus, troughcolor, width.

set(lo, hi)[source]

Set the fractional values of the slider position (upper and lower ends as value between 0 and 1).

class pyworkflow.gui.widgets.Button(master, text, imagePath=None, tooltip=None, **opts)[source]

Bases: Button

Construct a button widget with the parent MASTER.

STANDARD OPTIONS

activebackground, activeforeground, anchor, background, bitmap, borderwidth, cursor, disabledforeground, font, foreground highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, repeatdelay, repeatinterval, takefocus, text, textvariable, underline, wraplength

WIDGET-SPECIFIC OPTIONS

command, compound, default, height, overrelief, state, width

setImage(imagePath)[source]
class pyworkflow.gui.widgets.ComboBox(parent, choices, values=None, initial=None, onChange=None, **kwargs)[source]

Bases: Combobox

Extension of ttk.ComboBox to allow having different display text and values. Also adding some utils to getSelected index and value (same for set)

Create a combobox from a list of choices. Params:

parent: the parent widget (required by Tkinter) choices: a list with the options to be shown. values: if None, will enumerate from 0 to len(choices)-1

if a list is provided, should have the same length as choices.

initial: if None, take the first choice onChange: provide a callback function to be used when change the selected value **kwargs: extra arguments passed to ttk.Combobox constructor.

getIndex()[source]

Return the selected value.

getText()[source]

Return the selected option text.

getValue()[source]

Return the selected value.

setChangeCallback(callback)[source]
class pyworkflow.gui.widgets.ExplanationText(frame, text='', bg='#d9d9d9', border=0, wrap='word')[source]

Bases: Text

Create an explanation text box

Construct a text widget with the parent MASTER.

STANDARD OPTIONS

background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, takefocus, xscrollcommand, yscrollcommand,

WIDGET-SPECIFIC OPTIONS

autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap,

updateExpText(text, width=50)[source]
class pyworkflow.gui.widgets.GradientFrame(parent, **args)[source]

Bases: Canvas

A gradient frame which uses a canvas to draw the background Taken from:

Construct a canvas widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, closeenough, confine, cursor, height, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, offset, relief, scrollregion, selectbackground, selectborderwidth, selectforeground, state, takefocus, width, xscrollcommand, xscrollincrement, yscrollcommand, yscrollincrement.

class pyworkflow.gui.widgets.HotButton(master, text, imagePath=None, tooltip=None, **opts)[source]

Bases: Button

Button having the firebrick color and some other settings.

Construct a button widget with the parent MASTER.

STANDARD OPTIONS

activebackground, activeforeground, anchor, background, bitmap, borderwidth, cursor, disabledforeground, font, foreground highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, repeatdelay, repeatinterval, takefocus, text, textvariable, underline, wraplength

WIDGET-SPECIFIC OPTIONS

command, compound, default, height, overrelief, state, width

class pyworkflow.gui.widgets.IconButton(master, text, imagePath, tooltip=None, **opts)[source]

Bases: HotButton

Hot button, but only with image and no border

Construct a button widget with the parent MASTER.

STANDARD OPTIONS

activebackground, activeforeground, anchor, background, bitmap, borderwidth, cursor, disabledforeground, font, foreground highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, repeatdelay, repeatinterval, takefocus, text, textvariable, underline, wraplength

WIDGET-SPECIFIC OPTIONS

command, compound, default, height, overrelief, state, width

class pyworkflow.gui.widgets.LabelSlider(master, label, from_=0, to=100, value=50, callback=None, step=0.01, length=None, labelWidth=None, tickinterval=None, showvalue=None)[source]

Bases: Frame

Create a personalized frame that contains label, slider and label value it also keeps a variable with the value

Construct a Ttk Frame with parent master.

STANDARD OPTIONS

class, cursor, style, takefocus

WIDGET-SPECIFIC OPTIONS

borderwidth, relief, padding, width, height

get()[source]
highlightLabel()[source]
removeHighlightFromLabel()[source]
class pyworkflow.gui.widgets.Scrollable(master, WidgetClass, frame=True, **opts)[source]

Bases: object

This is a base class for all scrollable widgets. If it is enabled, it will wrap the widget with a frame and will add vertical and horizontal AutoScrollbar

bindWidget(widget)[source]

Make the scroll in the widget, respond to this. Useful for child widgets.

getHScroll()[source]
getVScroll()[source]
scroll(event)[source]
scrollH(event)[source]
scrollV(event)[source]