gtk.gdk Functionsthe gtk.gdk module functionsSynopsisgtk.gdk.Atom Functionsgtk.gdk.atom_internnameonly_if_existsFalsegtk.gdk.Color Functionsgtk.gdk.color_parsespecgtk.gdk.Colormap Functionsgtk.gdk.colormap_get_systemgtk.gdk.Device Functionsgtk.gdk.devices_listgtk.gdk.device_get_core_pointergtk.gdk.Display Functionsgtk.gdk.display_get_defaultgtk.gdk.DisplayManager Functionsgtk.gdk.display_manager_getgtk.gdk.Event Functionsgtk.gdk.events_pendinggtk.gdk.event_peekgtk.gdk.event_getgtk.gdk.event_get_graphics_exposewindowgtk.gdk.set_show_eventsshow_eventsgtk.gdk.get_show_eventsgtk.gdk.event_handler_setfuncdataNonegtk.gdk.Keymap Functionsgtk.gdk.keymap_get_defaultgtk.gdk.keymap_get_for_displaydisplaygtk.gdk.keyval_namekeyvalgtk.gdk.keyval_from_namekeyval_namegtk.gdk.keyval_convert_casesymbolgtk.gdk.keyval_to_upperkeyvalgtk.gdk.keyval_to_lowerkeyvalgtk.gdk.keyval_is_upperkeyvalgtk.gdk.keyval_is_lowerkeyvalgtk.gdk.keyval_to_unicodekeyvalgtk.gdk.unicode_to_keyvalwcgtk.gdk.PangoRenderer Functionsgtk.gdk.gdk_pango_renderer_get_defaultscreengtk.gdk.Pixbuf Functionsgtk.gdk.pixbuf_new_from_filefilenamegtk.gdk.pixbuf_new_from_file_at_sizefilenamewidthheightgtk.gdk.pixbuf_new_from_datadatacolorspacehas_alphabits_per_samplewidthheightrowstridegtk.gdk.pixbuf_new_from_arrayarraycolorspacebits_per_samplegtk.gdk.pixbuf_new_from_xpm_datadatagtk.gdk.pixbuf_new_from_inlinedata_lengthdatacopy_pixelsgtk.gdk.pixbuf_get_formatsgtk.gdk.pixbuf_get_file_infofilenamegtk.gdk.PixbufLoader Functionsgtk.gdk.pixbuf_loader_new_with_mime_typemime_typegtk.gdk.Pixmap Functionsgtk.gdk.bitmap_create_from_datadrawabledatawidthheightgtk.gdk.pixmap_create_from_datadrawabledatawidthheightdepthfgbggtk.gdk.pixmap_create_from_xpmwindowtransparent_colorfilenamegtk.gdk.pixmap_colormap_create_from_xpmwindowcolormaptransparent_colorfilenamegtk.gdk.pixmap_create_from_xpm_dwindowtransparent_colordatagtk.gdk.pixmap_colormap_create_from_xpm_dwindowcolormaptransparent_colordatagtk.gdk.pixmap_foreign_newanidgtk.gdk.pixmap_lookupanidgtk.gdk.pixmap_foreign_new_for_displaydisplayanidgtk.gdk.pixmap_lookup_for_displaydisplayanidgtk.gdk.Region Functionsgtk.gdk.region_rectanglerectanglegtk.gdk.Screen Functionsgtk.gdk.screen_widthgtk.gdk.screen_heightgtk.gdk.screen_width_mmgtk.gdk.screen_height_mmgtk.gdk.screen_get_defaultgtk.gdk.Visual Functionsgtk.gdk.list_visualsgtk.gdk.visual_get_bestgtk.gdk.visual_get_best_depthgtk.gdk.visual_get_best_typegtk.gdk.visual_get_best_with_depthdepthgtk.gdk.visual_get_best_with_typetypegtk.gdk.visual_get_systemgtk.gdk.query_depthsgtk.gdk.query_visual_typesgtk.gdk.Window Functionsgtk.gdk.window_foreign_newanidgtk.gdk.window_foreign_new_for_displaydisplayanidgtk.gdk.get_default_root_windowgtk.gdk.window_get_toplevelsgtk.gdk.window_lookupanidgtk.gdkwindow_lookup_for_display.displayanidgtk.gdk.window_process_all_updatesgtk.gdk.gdk_window_set_debug_updatesgtk.gdk.window_at_pointerMiscellaneous Functionsgtk.gdk.pointer_grabwindowowner_eventsFalseevent_mask0confine_toNonecursorNonetime0Lgtk.gdk.pointer_ungrabtime0Lgtk.gdk.keyboard_grabwindowowner_eventsFalsetime0Lgtk.gdk.keyboard_ungrabtime0Lgtk.gdk.pointer_is_grabbedgtk.gdk.flushgtk.gdk.beepgtk.gdk.set_double_click_timemsecgtk.gdk.threads_entergtk.gdk.threads_leavegtk.gdk.lockgtk.gdk.threads_initgtk.gdk.rgb_ditherablegtk.gdk.rgb_get_colormapgtk.gdk.rgb_set_verboseverbosegtk.gdk.rgb_set_installinstallgtk.gdk.rgb_set_min_colorsmin_colorsgtk.gdk.rgb_get_visualgtk.gdk.selection_owner_getselectiongtk.gdk.selection_owner_get_for_displaydisplayselectiongtk.gdk.selection_owner_set_for_displaydisplayownerselectiontimesend_eventgtk.gdk.selection_send_notifyrequestorselectiontargetpropertytimegtk.gdk.set_sm_client_idsm_client_idgtk.gdk.notify_startup_completegtk.gdk.get_program_classgtk.gdk.set_program_classprogram_classgtk.gdk.get_displaygtk.gdk.get_display_arg_namegtk.gdk.pango_context_get_for_screenscreengtk.gdk.pango_context_getgtk.gdk.x11_display_get_startup_notification_iddisplayDescriptionThese functions are part of the PyGTK gtk.gdk
module. All the functions are listed above with links to the function
description. Most functions are associated with a specific object class and
their descriptions are part of the class reference. Those functions that are
not directly associated with a specific class have their descriptions
below.Functionsgtk.gdk.pointer_grabgtk.gdk.pointer_grabwindowowner_eventsFalseevent_mask0confine_toNonecursorNonetime0Lwindow :the gtk.gdk.Window that
will own the grab (the grab window).owner_events :if False then all pointer
events are reported with respect to window and are
only reported if selected by event_mask. If
True then pointer events for this application are
reported as normal, but pointer events outside this application are reported
with respect to window and only if selected by
event_mask. In either mode, unreported events are
discarded.event_mask :specifies the event mask, that is used in
accordance with owner_events.confine_to :If not None, the pointer
will be confined to this gtk.gdk.Window
during the grab. If the pointer is outside
confine_to, it will automatically be moved to the
closest edge of confine_to and enter and leave events
will be generated as necessary.cursor :the gtk.gdk.Cursor to
display while the grab is active. If this is None then the normal cursors
are used for window and its descendants, and the
cursor for window is used for all other
windows.time :the timestamp of the event that led to this
pointer grab. This usually comes from a gtk.gdk.Event, though
0L can be used to use the current time if the time isn't
known.Returns :a grab status valueThe gtk.gdk.pointer_grab() function grabs
the pointer (usually a mouse) so that all events are passed to this
application until the pointer is ungrabbed with the gtk.gdk.pointer_ungrab(),
or the grab window becomes unviewable. This overrides any previous pointer
grab by this client. This function returns a grab status value:gtk.gdk.GRAB_SUCCESSThe resource was successfully grabbed.gtk.gdk.GRAB_ALREADY_GRABBEDThe resource is actively grabbed by another
client.gtk.gdk.GRAB_INVALID_TIMEThe resource was grabbed more recently than the
specified time.gtk.gdk.GRAB_NOT_VIEWABLEThe grab window or the
confine_to window are not viewable.gtk.gdk.GRAB_FROZENThe resource is frozen by an active grab of another
client.Pointer grabs are used for operations that need complete
control over mouse events, even if the mouse leaves the application. For
example it is used for drag and drop, for dragging the handle in the gtk.HPaned and gtk.VPaned widgets.
Note that if the event mask of an X window has selected both button press
and button release events, then a button press event will cause an automatic
pointer grab until the button is released. X does this automatically since
most applications expect to receive button press and release events in
pairs. It is equivalent to a pointer grab on the window with
owner_events set to True.gtk.gdk.pointer_ungrabgtk.gdk.pointer_ungrabtime0Ltime :a timestamp from a gtk.gdk.Event or 0L
to use the current timeThe gtk.gdk.pointer_ungrab() function
ungrabs the pointer if it is grabbed by this application.gtk.gdk.keyboard_grabgtk.gdk.keyboard_grabwindowowner_eventsFalsetime0Lwindow :the gtk.gdk.Window that
will own the grab (the grab window).owner_events :if False then all keyboard
events are reported with respect to window. If
True then keyboard events for this application are
reported as normal, but keyboard events outside this application are
reported with respect to window. Both key press and
key release events are always reported, independent of the event mask set by
the application.time :a timestamp from a gtk.gdk.Event or 0L
to use the current timeReturns :a grab status valueThe gtk.gdk.keyboard_grab() function grabs
the keyboard so that all events are passed to this application until the
keyboard is ungrabbed with the gtk.gdk.keyboard_ungrab())
function. This overrides any previous keyboard grab by this client.gtk.gdk.keyboard_ungrabgtk.gdk.keyboard_ungrabtime0Ltime :a timestamp from a gtk.gdk.Event or 0L
to use the current timeThe gtk.gdk.keyboard_ungrab() function
ungrabs the keyboard if it is grabbed by this application.gtk.gdk.pointer_is_grabbedgtk.gdk.pointer_is_grabbedReturns :True if the pointer is
currently grabbed by this application.The gtk.gdk.pointer_is_grabbed() function
returns True if the pointer is currently grabbed by this
application. Note that this does not take the implicit pointer grab on
button presses into account.gtk.gdk.flushgtk.gdk.flushThe gtk.gdk.flush() function flushes the X
output buffer and waits until all requests have been processed by the
server. This is rarely needed by applications.gtk.gdk.beepgtk.gdk.beepThe gtk.gdk.beep() function emits a short
beep.gtk.gdk.set_double_click_timegtk.gdk.set_double_click_timemsecmsec :the double click time in
millisecondsThe gtk.gdk.set_double_click_time()
function set the double click time for the default display. Applications
should NOT set this, it is a global user-configured setting.gtk.gdk.threads_entergtk.gdk.threads_enterThe gtk.gdk.threads_enter() function marks
the beginning of a critical section that only one thread can operate within
at a time. The critical section is guarded by a GDK
mutual exclusion lock. Python threads are enabled while waiting for the
GDK lock. See the gtk.gtk.threads_init()
function for more information about threading.gtk.gdk.threads_leavegtk.gdk.threads_leaveThe gtk.gdk.threads_leave() function marks
the end of a critical section started by the gtk.gdk.threads_enter()
function. See the gtk.gtk.threads_init()
function for more information about threading.gtk.gdk.lockgtk.gdk.lock
The gtk.gdk.lock constant is a context manager that calls
gtk.gdk.threads_enter
and gtk.gdk.threads_leave
in its __enter__ and __exit__ methods
correspondingly. It is intended to be used in with statement,
new in Python 2.5. Read statement description for details.
gtk.gdk.threads_initgtk.gdk.threads_initThe gtk.gdk.threads_init() function
initializes PyGTK to use the Python macros that allow
multiple threads to serialize access to the Python interpreter (using the
Python Global Interpreter Lock (GIL)). In addition, the
gtk.gdk.threads_init() function initializes the
GDK global lock (mutex) that serializes thread access to
the GTK and GDK libraries. Thus there
are two different global locking mechanisms at work that are initialized by
the gtk.gdk.threads_init() function: Python and
GDK.The gtk.gdk.threads_init() function must be
called before the gtk.main()
function. At this point in the application the Python GIL is held by the
main application thread. (Usually the main thread calls the
gtk.gdk.threads_init() function though any thread could
call it instead.) When the gtk.main() function
is called the GIL is released and other threads may use the Python
interpreter. When PyGTK signal handlers are invoked in
the main thread the GIL is reacquired so that the Python interpreter can run
the handler code.gtk.gdk.rgb_ditherablegtk.gdk.rgb_ditherableReturns :True if the gtk.gdk.Visual is
ditherableThe gtk.gdk.rgb_ditherable() function
returns True if the gtk.gdk.Visual is
ditherable. This function may be useful for presenting a user interface
choice to the user about which dither mode is desired; if the display is not
ditherable, it may make sense to gray out or hide the corresponding UI
widget.gtk.gdk.rgb_get_colormapgtk.gdk.rgb_get_colormapReturns :the preferred gtk.gdk.Colormap
for rendering image data.The gtk.gdk.rgb_get_colormap() function
returns the preferred gtk.gdk.Colormap.gtk.gdk.rgb_set_verbosegtk.gdk.rgb_set_verboseverboseverbose :If True messages should be
verboseThe gtk.gdk.rgb_set_verbose() function sets
the "verbose" flag to the value specified by verbose.
If verbose is True messages will
be verbose. This is generally only useful for debugging.gtk.gdk.rgb_set_installgtk.gdk.rgb_set_installinstallinstall :if True set install
modeThe gtk.gdk.rgb_set_install() function sets
the "install" mode to the value of install. If
install is True, a new "private"
colormap is always installed rather than trying to find a best fit with the
colors already allocated. Ordinarily, a colormap only be installed if a
sufficient cube cannot be allocated. A private colormap has more colors,
leading to better quality display, but also leads to the dreaded "colormap
flashing" effect.gtk.gdk.rgb_set_min_colorsgtk.gdk.rgb_set_min_colorsmin_colorsmin_colors :the minimum number of
colors.The gtk.gdk.rgb_set_min_colors() function
sets the minimum number of colors for the color cube to the value specified
by min_colors. Generally, the largest color cube is
allocated. If a color cube at least as large as
min_colors can't be allocated, a private colormap is
installed. gtk.gdk.rgb_get_visualgtk.gdk.rgb_get_visualReturns :the gtk.gdk.Visual being
usedThe gtk.gdk.rgb_get_visual() function
returns the gtk.gdk.Visual being
used to render image data on the default screen.gtk.gdk.selection_owner_getgtk.gdk.selection_owner_getselectionselection :an atom indentifying a
selection.Returns :the gtk.gdk.Window that
owns the selection or None.The gtk.gdk.selection_owner_get() function
returns the gtk.gdk.Window that
owns the selection specified by selection if there is
a selection owner for this window, and if it is a window known to the
current application. Note that the return value may be owned by a different
process if a foreign window was previously created for that window, but a
new foreign window will never be created by this call.gtk.gdk.selection_owner_get_for_displaygtk.gdk.selection_owner_get_for_displaydisplayselectiondisplay :A gtk.gdk.Display.
selection :an atom indentifying a selection.Returns :If there is a selection owner for this window, and it is
a window known to the current process, the
gtk.gdk.Window that
owns the selection or None.
The gtk.gdk.selection_owner_get_for_display() function
determine the owner of the given selection.
Note that the return value may be owned by a different process if a foreign
window was previously created for that window, but a new foreign window will
never be created by this call.
gtk.gdk.selection_owner_set_for_displaygtk.gdk.selection_owner_set_for_displaydisplayownerselectiontimwsend_eventdisplay :A gtk.gdk.Display.
owner :A gtk.gdk.Window
or None to indicate that the owner for the given should be unset.
selection :an atom indentifying a selection.time :timestamp to use when setting the selection. If this is
older than the timestamp given last time the owner was set for the given
selection, the request will be ignored.send_event :if True, and the new owner is different
from the current owner, the current owner will be sent a SelectionClear
event.Returns :True if the selection owner was successfully
changed to owner, otherwise False.
The gtk.gdk.selection_owner_set_for_display() function
sets the gtk.gdk.Window
owner as the current owner of the selection selection.
gtk.gdk.selection_send_notifygtk.gdk.selection_send_notifyrequestorselectiontargetpropertytimerequestor :the integer ID of the window to deliver the
response to.selection :an atom representing the selection that was
requested.target :an atom representing the target that was
selected. property :an atom representing the property in which the
selection owner stored the data.time :a timestampThe gtk.gdk.selection_send_notify()
function sends a response to a SelectionRequest event.gtk.gdk.set_sm_client_idgtk.gdk.set_sm_client_idsm_client_idsm_client_id :the client id string assigned by the session
manager when the connection was openedThe gtk.gdk.set_sm_client_id() function
sets the SM_CLIENT_ID property on the application's
leader window so that the window manager can save the application's state
using the X11R6 ICCCM session management protocol. See the X Session
Management Library documentation for more information on session management
and the Inter-Client Communication Conventions Manual (ICCCM) for
information on the WM_CLIENT_LEADER property. (Both
documents are part of the X Window System distribution.)gtk.gdk.notify_startup_completegtk.gdk.notify_startup_completeThis function is available in PyGTK 2.8 and aboveThe gtk.gdk.notify_startup_complete()
function indicates to the GUI environment that the application has finished
loading. If the applications opens windows, this function is normally called
after opening the application's initial set of windows.GTK+ will call this function automatically after opening the
first gtk.Window unless
the gtk.window_set_auto_startup_notification()
function is called to disable that feature.gtk.gdk.get_program_classgtk.gdk.get_program_classReturns :the program classThis function is available in PyGTK 2.8 and aboveThe gtk.gdk.get_program_class() function
returns the program class. Unless the program class has explicitly been set
with the gtk.gdk.set_program_class()
function or with the commandline option, the
default value is the program name with the first character converted to
uppercase.gtk.gdk.set_program_classgtk.gdk.set_program_classprogram_classprogram_class :a string containing the program
classThis function is available in PyGTK 2.8 and aboveThe gtk.gdk.set_program_class() function
sets the program class to the string contained in
program_class. The X11 backend
uses the program class to set the class name part of the
WM_CLASS property on toplevel windows.gtk.gdk.get_displaygtk.gdk.get_displayReturns :the name of the displayThis function is available in PyGTK 2.8 and aboveThe gtk.gdk.get_display() function returns
the name of the display, which is usually derived from the
DISPLAY environment variable or the
command line option.gtk.gdk.get_display_arg_namegtk.gdk.get_display_arg_nameReturns : the display name, if specified explicitly, or
None.This function is available in PyGTK 2.8 and aboveThe gtk.gdk.get_display_arg_name() function
returns the display name specified in the command line arguments, if any or
None if the display name was not explicitly set.gtk.gdk.pango_context_get_for_screengtk.gdk.pango_context_get_for_screenscreenscreen :a gtk.gdk.ScreenReturns :a new pango.Context
objectThis function is available in PyGTK 2.8 and aboveThe
gtk.gdk.pango_context_get_for_screen() function
creates a new pango.Context
object for the gtk.gdk.Screen
specified by screen. Normally you should use the
get_pango_context()
method instead of this function, to get the appropriate Pango context for
the widget you intend to render text onto.gtk.gdk.pango_context_getgtk.gdk.pango_context_getReturns :a new pango.Context
for the default display.This function is available in PyGTK 2.8 and aboveThe gtk.gdk.pango_context_get()
function creates a new pango.Context for
the default display. Normally you should use the get_pango_context()
method instead of this function, to get the appropriate Pango context for
the widget you intend to render text onto.gtk.gdk.x11_display_get_startup_notification_idgtk.gdk.x11_display_get_startup_notification_iddisplaydisplay :a gtk.gdk.DisplayReturns :the startup notification ID for displayThis function is available in PyGTK 2.12 and aboveThe
gtk.gdk.x11_display_get_startup_notification_id() function
gets the startup notification ID for a display.