当前位置: 首页>>代码示例>>Python>>正文


Python gtk.DrawingArea方法代码示例

本文整理汇总了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 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:27,代码来源:xdot.py

示例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) 
开发者ID:inconvergent,项目名称:tree,代码行数:23,代码来源:render.py

示例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() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:29,代码来源:ft.py

示例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() 
开发者ID:ActiveState,项目名称:code,代码行数:14,代码来源:recipe-576820.py

示例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")) 
开发者ID:ActiveState,项目名称:code,代码行数:8,代码来源:recipe-576820.py

示例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() 
开发者ID:Borda,项目名称:pyImSegm,代码行数:32,代码来源:gui_annot_center_correction.py

示例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) 
开发者ID:OpenXenManager,项目名称:openxenmanager,代码行数:16,代码来源:chart.py

示例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 
开发者ID:ym2011,项目名称:POC-EXP,代码行数:30,代码来源:xdot.py


注:本文中的gtk.DrawingArea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。