本文整理汇总了Python中gtk.DrawingArea方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.DrawingArea方法的具体用法?Python gtk.DrawingArea怎么用?Python gtk.DrawingArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.DrawingArea方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def __init__(self):
gtk.DrawingArea.__init__(self)
self.graph = Graph()
self.openfilename = None
self.set_flags(gtk.CAN_FOCUS)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
self.connect("button-press-event", self.on_area_button_press)
self.connect("button-release-event", self.on_area_button_release)
self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
self.connect("motion-notify-event", self.on_area_motion_notify)
self.connect("scroll-event", self.on_area_scroll_event)
self.connect("size-allocate", self.on_area_size_allocate)
self.connect('key-press-event', self.on_key_press_event)
self.x, self.y = 0.0, 0.0
self.zoom_ratio = 1.0
self.zoom_to_fit_on_resize = False
self.animation = NoAnimation(self)
self.drag_action = NullAction(self)
self.presstime = None
self.highlight = None
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def __init__(self, n, front, back, trunk, trunk_stroke, grains,
steps_itt, step):
Render.__init__(self, n, front, back, trunk, trunk_stroke, grains)
window = gtk.Window()
window.resize(self.n, self.n)
self.steps_itt = steps_itt
self.step = step
window.connect("destroy", self.__destroy)
darea = gtk.DrawingArea()
darea.connect("expose-event", self.expose)
window.add(darea)
window.show_all()
self.darea = darea
self.steps = 0
gobject.idle_add(self.step_wrap)
示例3: draw_gtk
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def draw_gtk(p):
win = gtk.Window()
win.set_title('Family tree')
win.connect('destroy', lambda widget: gtk.main_quit())
sw = gtk.ScrolledWindow()
win.add(sw)
da = gtk.DrawingArea()
def draw(widget, event):
global ctx
ctx = da.window.cairo_create()
draw_tree(p)
w = int(p.get('w') + 1)
h = int(p.get('h') + 1)
da.set_size_request(w, h)
w = min(w, 1200)
sw.set_size_request(w, h + 60)
da.connect('expose_event', draw)
sw.add_with_viewport(da)
win.show_all()
gtk.main()
示例4: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title("Drawing Area Example")
window.connect("destroy", lambda w: gtk.main_quit())
self.area = gtk.DrawingArea()
self.area.set_size_request(400, 300)
window.add(self.area)
self.area.connect("expose-event", self.area_expose_cb)
self.area.show()
window.show()
self.do_print()
示例5: format_text
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def format_text(self):
self.pangolayout.set_text(unicode("""
Dies ist ein Text-Test. Er funktioniert gut und zeigt, dass auch PyGTK
das drucken kann, was man auf eine DrawingArea geschrieben hat.
Anwendungen dafür gibt es genug!
""", "latin-1"))
示例6: main
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def main(params):
global fig, paths_img_csv, actual_idx, df_info_all
win = gtk.Window()
win.set_default_size(600, 400)
win.set_title('Annotation (correction) egg centers')
win.connect('destroy', lambda x: gtk.main_quit())
fig = Figure()
fig.subplots_adjust(left=0, bottom=0, right=1, top=1)
canvas = FigureCanvasGTKAgg(fig) # a gtk.DrawingArea
win.add(canvas)
actual_idx = 0
paths_img_csv = load_paths_image_csv(params)
logging.info('loaded %i pairs (image & centers)', len(paths_img_csv))
assert paths_img_csv, 'missing paths image - csv'
if params['path_info'] is not None and os.path.isfile(params['path_info']):
df_info_all = pd.read_csv(params['path_info'], sep='\t', index_col=0)
else:
df_info_all = None
logging.info('loaded complete info')
canvas_load_image_centers()
fig.canvas.mpl_connect('button_press_event', onclick)
win.connect('key-release-event', onkey_release)
win.show_all()
gtk.main()
示例7: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def __init__(self):
gtk.DrawingArea.__init__(self)
#private properties:
self._padding = 0
#objects needed for every chart:
self.background = Background()
self.background.connect("appearance-changed", self._cb_appearance_changed)
self.title = Title()
self.title.connect("appearance-changed", self._cb_appearance_changed)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK|gtk.gdk.SCROLL_MASK|gtk.gdk.POINTER_MOTION_MASK)
self.connect("expose_event", self._cb_expose_event)
self.connect("button_press_event", self._cb_button_pressed)
self.connect("motion-notify-event", self._cb_motion_notify)
示例8: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import DrawingArea [as 别名]
def __init__(self):
gtk.DrawingArea.__init__(self)
self.graph = Graph()
self.openfilename = None
self.set_flags(gtk.CAN_FOCUS)
self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
self.connect("button-press-event", self.on_area_button_press)
self.connect("button-release-event", self.on_area_button_release)
self.add_events(gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.POINTER_MOTION_HINT_MASK | gtk.gdk.BUTTON_RELEASE_MASK)
self.connect("motion-notify-event", self.on_area_motion_notify)
self.connect("scroll-event", self.on_area_scroll_event)
self.connect("size-allocate", self.on_area_size_allocate)
self.connect('key-press-event', self.on_key_press_event)
self.last_mtime = None
gobject.timeout_add(1000, self.update)
self.x, self.y = 0.0, 0.0
self.zoom_ratio = 1.0
self.zoom_to_fit_on_resize = False
self.animation = NoAnimation(self)
self.drag_action = NullAction(self)
self.presstime = None
self.highlight = None