免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1294 | 回复: 0
打印 上一主题 下一主题

gtk.DrawingArea类 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-01 14:23 |只看该作者 |倒序浏览

最近用到了这个,特意把这个粘下来。
gtk.DrawingArea
gtk.DrawingArea — a widget for custom user interface elements.
Synopsis
class gtk.DrawingArea(
gtk.Widget
):
   
gtk.DrawingArea
()
Ancestry+-- gobject.GObject
  +--
gtk.Object
    +--
gtk.Widget
      +--
gtk.DrawingArea
Implemented Interfaces
gtk.DrawingArea
implements
gtk.Buildable

gtk.DrawingArea Properties
gtk.Object Properties
gtk.Widget Properties
gtk.DrawingArea Style Properties
gtk.Widget Style Properties
gtk.DrawingArea Signal Prototypes
gobject.GObject Signal Prototypes
gtk.Object Signal Prototypes
gtk.Widget Signal Prototypes
Description
The
gtk.DrawingArea
widget is used for creating custom user interface elements. It's essentially a blank widget containing a
gtk.gdk.Window
that you can draw on. The contained
gtk.gdk.Window
is accessed using the
gtk.Widget
"window" attribute as:
  gdkwindow = drawingarea.window
Since a
gtk.gdk.Window
is a subclass of
gtk.gdk.Drawable
, all of the
gtk.gdk.Drawable
methods are available for drawing on the
gtk.DrawingArea
's gdkwindow.
After creating a drawing area, the application may want to connect to:

  • Mouse and button press signals to respond to input from the user. Use the
    gtk.Widget.add_events()
    method to enable events you wish to receive. To receive keyboard events, you will need to set the gtk.CAN_FOCUS flag on the drawing area

  • The "realize" signal to take any necessary actions when the widget is instantiated on a particular display.

  • The "configure_event" signal to take any necessary actions when the widget changes size.

  • 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
    gtk.Widget.queue_draw_area()
    method.

    See the
    Drawing Area
    chapter in the tutorial for more information on using a
    gtk.DrawingArea
    .
    Sometimes a
    gtk.Image
    is a useful alternative to a drawing area. You can put a
    gtk.gdk.Pixmap
    in the
    gtk.Image
    and draw to the
    gtk.gdk.Pixmap
    , calling the
    gtk.Widget.queue_draw()
    method on the
    gtk.Image
    when you want to refresh to the screen.
    Constructor    gtk.DrawingArea()
    Returns :
    a new drawingarea widget

    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/48817/showart_722845.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP