Window.beginDrawFrame

Indicates that you are beginning the process of redrawing region on window, and provides you with a gdk.DrawingContext

If window is a top level gdk.Window, backed by a native window implementation, a backing store (offscreen buffer) large enough to contain region will be created. The backing store will be initialized with the background color or background surface for window. Then, all drawing operations performed on window will be diverted to the backing store. When you call Window.endFrame, the contents of the backing store will be copied to window, making it visible on screen. Only the part of window contained in region will be modified; that is, drawing operations are clipped to region.

The net result of all this is to remove flicker, because the user sees the finished product appear all at once when you call Window.endDrawFrame. If you draw to window directly without calling Window.beginDrawFrame, the user may see flicker as individual drawing operations are performed in sequence.

When using GTK+, the widget system automatically places calls to Window.beginDrawFrame and Window.endDrawFrame around emissions of the GtkWidget::draw signal. That is, if you’re drawing the contents of the widget yourself, you can assume that the widget has a cleared background, is already set as the clip region, and already has a backing store. Therefore in most cases, application code in GTK does not need to call Window.beginDrawFrame explicitly.

class Window
beginDrawFrame

Parameters

region Region

a Cairo region

Return Value

a gdk.DrawingContext context that should be used to draw the contents of the window; the returned context is owned by GDK.

Meta

Since

3.22