PyGobject(九十四)Cairo系列——画基本图形
2016-08-03 09:46
239 查看
例子
代码:
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
例子
代码:
#!/usr/bin/env python3 # Created by xiaosanyu at 16/7/6 # section 144 TITLE = "Basic shapes" DESCRIPTION = """ This example draws some basic shapes onto the window """ import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk import math class PyApp(Gtk.Window): def __init__(self): super(PyApp, self).__init__() self.set_title("Basic shapes") self.set_size_request(390, 240) self.connect("destroy", Gtk.main_quit) darea = Gtk.DrawingArea() darea.connect("draw", self.draw) self.add(darea) self.show_all() @staticmethod def draw(widget, cr): cr.set_source_rgb(0.6, 0.6, 0.6) cr.rectangle(20, 20, 120, 80) cr.rectangle(180, 20, 80, 80) cr.fill() cr.arc(330, 60, 40, 0, 2 * math.pi) cr.fill() cr.arc(90, 160, 40, math.pi / 4, math.pi) cr.fill() cr.translate(220, 180) cr.scale(1, 0.7) cr.arc(0, 0, 50, 0, 2 * math.pi) cr.fill() def main(): PyApp() Gtk.main() if __name__ == "__main__": main()
代码下载地址:http://download.csdn.net/detail/a87b01c14/9594728
相关文章推荐
- 一步一步学Silverlight 2系列(26):基本图形
- 一步一步学Silverlight 2系列(26):基本图形
- PyGobject(九十五)Cairo系列——渐变
- PyGobject(一百)Cairo系列——cairo.Surface实现图片倒影
- PyGobject(九十九)Cairo系列——环形加载图标
- 一步一步学Silverlight 2系列(26):基本图形
- RGraph 系列文章(四):基本图形示例
- SDL游戏开发系列第二话:基本图形的绘制
- Cairo 图形指南 (4) —— 基本绘图
- PyGobject(一百零二)Cairo系列——贪吃蛇游戏
- Cairo 图形指南 (4) —— 基本绘图
- Cairo 图形指南(1) —— 基本绘图
- Cairo 图形指南(1) —— 基本绘图
- PyGobject(九十三)Cairo系列——简介&简单示例
- 一步一步学Silverlight 2系列(26):基本图形 (转)
- 【D3.V3.js系列教程】--(十五)SVG基本图形绘制
- /LGC图形渲染/图形学系列 -- 图形学基本概念汇编
- Android游戏开发系列教程第二讲(基本图形绘制)
- PyGobject(九十七)Cairo系列——环状线圈
- Android绘图系列(二)——自定义View绘制基本图形