File: class-gtkdrawingarea.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (37 lines) | stat: -rw-r--r-- 7,214 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.DrawingArea</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtkdialog.html" title="gtk.Dialog"><link rel="next" href="class-gtkeditable.html" title="gtk.Editable"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.DrawingArea</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkdialog.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkeditable.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkdrawingarea"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.DrawingArea</h2><p>gtk.DrawingArea &#8212; a widget for custom user interface elements.</p></div><div class="refsect1" lang="en"><a name="id3402922"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.DrawingArea</span></span>(<span class="ooclass"><span class="classname"><a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtkdrawingarea.html#constructor-gtkdrawingarea" title="Constructor">gtk.DrawingArea</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3402959"></a><h2>Ancestry</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="synopsis">+-- <a href="class-gobject.html" title="gobject.GObject">gobject.GObject</a>
  +-- <a href="class-gtkobject.html" title="gtk.Object">gtk.Object</a>
    +-- <a href="class-gtkwidget.html" title="gtk.Widget">gtk.Widget</a>
      +-- <a href="class-gtkdrawingarea.html" title="gtk.DrawingArea">gtk.DrawingArea</a>
</pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3402989"></a><h2>Description</h2><p>The <a href="class-gtkdrawingarea.html" title="gtk.DrawingArea"><tt class="classname">gtk.DrawingArea</tt></a>
widget is used for creating custom user interface elements. It's essentially
a blank widget containing a <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a> that
you can draw on. The contained <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a> is
accessed using the <a href="class-gtkwidget.html" title="gtk.Widget"><tt class="classname">gtk.Widget</tt></a> "window"
attribute as:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  gdkwindow = drawingarea.window
</pre></td></tr></table><p>Since a <a href="class-gdkwindow.html" title="gtk.gdk.Window"><tt class="classname">gtk.gdk.Window</tt></a>
    is a subclass of <a href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><tt class="classname">gtk.gdk.Drawable</tt></a>,
    all of the <a href="class-gdkdrawable.html" title="gtk.gdk.Drawable"><tt class="classname">gtk.gdk.Drawable</tt></a>
    methods are available for drawing on the <a href="class-gtkdrawingarea.html" title="gtk.DrawingArea"><tt class="classname">gtk.DrawingArea</tt></a>'s
    gdkwindow.</p><p>After creating a drawing area, the application may want to
connect to:</p><div class="itemizedlist"><ul type="disc"><li><p>Mouse and button press signals to respond to input from the
user. Use the <a href="class-gtkwidget.html#method-gtkwidget--add-events" title="gtk.Widget.add_events"><tt class="methodname">gtk.Widget.add_events</tt>()</a>
method to enable events you wish to receive. To receive keyboard events, you
will need to set the <tt class="literal">gtk.CAN_FOCUS</tt> flag on the drawing
area</p></li><li><p>The "realize" signal to take any necessary actions when the
widget is instantiated on a particular display.</p></li><li><p>The "configure_event" signal to take any necessary actions
when the widget changes size.</p></li><li><p>The "expose_event" signal to handle redrawing the contents of
the widget when a drawing area first comes on screen, or when it's covered by
another window and then uncovered (exposed). You can also force an expose
event by adding to the "damage region" of the drawing area's window using
the <a href="class-gtkwidget.html#method-gtkwidget--queue-draw-area" title="gtk.Widget.queue_draw_area"><tt class="methodname">gtk.Widget.queue_draw_area</tt>()</a>
method.</p></li></ul></div><p>See the <a href="../pygtk2tutorial/ch-DrawingArea.html" target="_top">Drawing
Area</a> chapter in the tutorial for more information on using a <a href="class-gtkdrawingarea.html" title="gtk.DrawingArea"><tt class="classname">gtk.DrawingArea</tt></a>.</p><p>Sometimes a <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> is a useful
alternative to a drawing area. You can put a <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a> in
the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a>
and draw to the <a href="class-gdkpixmap.html" title="gtk.gdk.Pixmap"><tt class="classname">gtk.gdk.Pixmap</tt></a>,
calling the <a href="class-gtkwidget.html#method-gtkwidget--queue-draw" title="gtk.Widget.queue_draw"><tt class="methodname">gtk.Widget.queue_draw</tt>()</a>
method on the <a href="class-gtkimage.html" title="gtk.Image"><tt class="classname">gtk.Image</tt></a> when you
want to refresh to the screen.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkdrawingarea"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.DrawingArea</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new drawingarea widget</td></tr></tbody></table><p>Creates a new <a href="class-gtkdrawingarea.html" title="gtk.DrawingArea"><tt class="classname">gtk.DrawingArea</tt></a>
widget.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkdialog.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkeditable.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.Dialog</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.Editable</td></tr></table></div></body></html>