GLXCurses.Widget module

class GLXCurses.Widget.Widget[source]

Bases: GLXCurses.Object.Object, GLXCurses.Aera.Area, GLXCurses.libs.Colorable.Colorable

Return type:object
preferred_height
preferred_width
app_paintable

Whether the application will paint directly on the widget.

Owner: Widget Flags: Read / Write Default value: FALSE
Returns:True or False
Return type:bool
can_default

Whether the widget can be the default widget.

Owner: Widget Flags: Read / Write Default value: False
Returns:True if widget can be a default widget, False otherwise
Return type:bool
events
Owner: Widget Flags: Read Default value: False
Returns:list of flags content in GLXC.EventMask
Return type:list
can_focus

Whether the widget can accept the input focus.

Owner: Widget Flags: Read / Write Default value: False
Returns:True or False
Return type:bool
can_prelight

If True if the widget will display prelight color.

By default that if False, by exemple a container is a hidden Widget and have no raison to display prelight.

At the oposit the prelight of a button can be disable with it property

Returns:True or False
Return type:bool
composite_child

Whether the widget is part of a composite widget.

Returns:True or False
Return type:bool
expand

Whether to expand in both directions. Setting this sets both “hexpand” and “vexpand”

Returns:True or False
Return type:bool
focus_on_click

Whether the widget should grab focus when it is clicked with the mouse.

This property is only relevant for widgets that can take focus.

Returns:True or False
Return type:bool
halign

How to distribute horizontal space if widget gets extra space, see GLXC.Align

Allowed value:
Stretch to fill all space if possible, center if no meaningful way to stretch
GLXC.ALIGN_FILL = ‘FILL’
Snap to left or top side, leaving space on right or bottom
GLXC.ALIGN_START = ‘START’
Snap to right or bottom side, leaving space on left or top
GLXC.ALIGN_END = ‘END’
Center natural width of widget inside the allocation
GLXC.ALIGN_CENTER = ‘CENTER’
Align the widget according to the baseline.
GLXC.ALIGN_BASELINE = ‘BASELINE’
Returns:a GLXC.Align
Return type:str
has_default

Whether the widget is the default widget.

Returns:True or False
Return type:bool
has_focus

Whether the widget has the input focus.

Returns:True or False
Return type:bool
has_prelight

Whether the widget is pre light.

Returns:True or False
Return type:bool
has_tooltip

Enables or disables the emission of “query-tooltip” on widget . A value of True indicates that widget can have a tooltip, in this case the widget will be queried using “query-tooltip” to determine whether it will provide a tooltip or not.

Returns:True or False
Return type:bool
height_request

Override for height request of the widget, or -1 if natural request should be used.

Returns:height_request property value
Return type:int
hexpand

Whether to expand horizontally.

Returns:True if the widget have to expand horizontally
Return type:bool
hexpand_set

Whether to use the “hexpand” property

Returns:True if the widget use the “hexpand” property
Return type:bool
is_focus

Whether the widget is the focus widget within the toplevel.

Returns:True if the widget is the focus widget within the toplevel.
Return type:bool
margin

All four sides’ margin at once. If read, returns max margin on any side.

Allowed values: [0,32767]

Returns:max margin on any side
Return type:int
margin_bottom

This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from Widget.set_size_request() for example.

Allowed values: [0,32767]

Returns:Margin on bottom side of widget.
Return type:int
margin_end

Margin on end of widget, horizontally. This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from Widget.set_size_request() for example.

Allowed values: [0,32767]

Returns:Margin on end of widget, horizontally.
Return type:int
margin_start

Margin on start of widget, horizontally. This property supports left-to-right and right-to-left text directions.

This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from Widget.set_size_request() for example.

Allowed values: [0,32767]

Returns:Margin on start of widget, horizontally.
Return type:int
margin_top

Margin on top side of widget.

This property adds margin outside of the widget’s normal size request, the margin will be added in addition to the size from Widget.set_size_request() for example.

Allowed values: [0,32767]

Returns:Margin on top side of widget.
Return type:int
name

The name of the widget.

Returns:name of the widget.
Return type:str
no_show_all

Whether Widget.show_all() should not affect this widget.

Returns:If True, Widget.show_all() should not affect this widget
Return type:bool
parent

The parent GLXCurses.Container of this GLXCurses.Widget. Must be a GLXCurses.Container.

Returns:The parent of the GLXCurses.Widget
Return type:GLXCurses.Container
receives_default

If True, the widget will receive the default action when it is focused.

Returns:True if the widget receives default
Return type:bool
sensitive

Whether the widget responds to input.

Returns:True if teh widget responds to input
Return type:bool
style

The style of the widget, which contains information about how it will look (colors, etc).

Returns:a GLXCurses.Style instance
Return type:GLXCurses.Style
tooltip_text

This is a convenience property which will take care of getting the tooltip shown if the given string is not NULL: has-tooltip will automatically be set to TRUE and there will be taken care of “query-tooltip” in the default signal handler.

Returns:tooltip_text property value
Return type:str or None
valign

How to distribute vertical space if widget gets extra space, see GLXC.Align

Default value: GLXC.ALIGN_FILL

Returns:The “valign” property
Return type:GLXC.Align
vexpand

Whether to expand vertically. See Widget().set_vexpand().

Returns:True if teh widget have to expand vertically
Return type:bool
vexpand_set

Whether to use the “vexpand” property

Returns:True if the widget use the “vexpand” property
Return type:bool
visible

Whether the widget is visible.

Default value: False

Returns:True if the widget is visible.
Return type:bool
width_request

Override for width request of the widget, or -1 if natural request should be used.

Returns:width_request property value
Return type:int
window

The widget’s window if it is realized, None otherwise.

Returns:return the Window object if realized, None otherwise
Return type:GLXCurses.Window or None
new()[source]

Not totally like GTK yet …

Actually:
The Widget.New() “can be” and “is” overridden by each GLXCurses Components.
Original GTK:
This is a convenience function for creating a widget and setting its properties in one go. For example you might write: Widget().New(GLXC.TYPE_LABEL, “label”, “Hello World”, “xalign”, 0.0, NULL) to create a left-aligned label.
Returns:the GLXCurses.Widget
Return type:GLXCurses.Widget
destroy()[source]

Destroy the object

in_destruction

Returns whether the widget is currently being destroyed.

This information can sometimes be used to avoid doing unnecessary work.

Returns:True if widget is being destroyed
Return type:bool
destroyed(widget=None, widget_pointer=None)[source]
unparent(widget=None)[source]

This function is only for use in widget implementations. Should be called by implementations of the remove method on Container, to dissociate a child from the container.

Parameters:

widget (GLXCurses.Widget) – a GLXCurses.Widget

Raises:
  • TypeError – if widget is not a valid GLXCurses type.
  • TypeError – if widget is not a instance of GLXCurses.Widget.
show()[source]

Flags a widget to be displayed. Any widget that isn’t shown will not appear on the stdscr.

If you want to show all the widgets in a container, it’s easier to call GLXCurses.Widget.show_all() on the container, instead of individually showing the widgets.

Remember that you have to show the containers containing a widget, in addition to the widget itself, before it will appear onscreen.

When a toplevel container is shown, it is immediately realized and mapped; other shown widgets are realized and mapped when their toplevel container is realized and mapped.

show_now()[source]

Shows a widget.

If the widget is an unmapped toplevel widget (i.e. a GLXCurses.Window that has not yet been shown), enter the main loop and wait for the window to actually be mapped.

Be careful; because the main loop is running, anything can happen during this function.

hide()[source]

Reverses the effects of GLXCurses.Widget.show(), causing the widget to be hidden (invisible to the user).

show_all()[source]

Recursively shows a widget, and any child widgets (if the widget is a container).

map

This function is only for use in widget implementations. Causes a widget to be mapped if it isn’t already.

realize

Creates the GLXCurses (windowing system) resources associated with a widget. For example, widget->window will be created when a widget is realized. Normally realization happens implicitly; if you show a widget and all its parent containers, then the widget will be realized and mapped automatically.

Realizing a widget requires all the widget’s parent widgets to be realized; calling Widget.realize() realizes the widget’s parents in addition to widget itself. If a widget is not yet inside a toplevel window when you realize it, bad things will happen.

This function is primarily used in widget implementations, and isn’t very useful otherwise. Many times when you think you might need it, a better approach is to connect to a signal that will be called after the widget is realized automatically, such as “draw”. Or simply g_signal_connect() to the “realize” signal.

Returns:the realize property value
Return type:bool
child_visible

he set_child_visible() method determines if the widget should be mapped along with its parent.

Returns:
get_toplevel()[source]
set_decorated(decorated)[source]
get_decorated()[source]
refresh()[source]
override_color(color)[source]
override_background_color(color)[source]
attribute_states

Return the __attribute_states attribute, it consist to a dictionary it store a second level of dictionary with keys if have special name.

Returns:attribute states dictionary on Galaxie Curses Style format
Return type:dict
has_window

Determines whether widget has a GdkWindow of its own.

See GLXCurses.Widget.set_has_window().

Returns:TRUE if widget has a window, FALSE otherwise
Return type:bool
draw()[source]
draw_widget_in_area()[source]

Be here for be overwrite by every widget

unchild(widget=None)[source]