コード例 #1
0
        geometry=(800, 800),
        vertex_fill_color=ug.vp.lum,
        vertex_size=gt.prop_to_size(ug.vp.mass,
                                    mi=2,
                                    ma=10,
                                    log=False,
                                    power=2),
    )
else:
    win = Gtk.OffscreenWindow()
    win.set_default_size(800, 800)
    win.graph = gt.GraphWidget(
        ug,
        pos,
        vertex_fill_color=ug.vp.lum,
        vertex_size=gt.prop_to_size(ug.vp.mass,
                                    mi=2,
                                    ma=10,
                                    log=False,
                                    power=2),
    )
    win.add(win.graph)

count = 0


##
def update_state():

    global ibin
    global count
    global step
コード例 #2
0
    win = gt.GraphWindow(g,
                         pos,
                         geometry=(500, 400),
                         edge_color=[0.6, 0.6, 0.6, 1],
                         vorder=visited,
                         vertex_size=vsize,
                         vertex_fill_color=g.vp['comm_infomap'],
                         vertex_halo=mark,
                         vertex_halo_color=[0.8, 0, 0, 0.6])
else:
    win = Gtk.OffscreenWindow()
    win.set_default_size(500, 400)
    win.graph = gt.GraphWidget(g,
                               pos,
                               edge_color=[0.6, 0.6, 0.6, 1],
                               vorder=visited,
                               vertex_size=vsize,
                               vertex_fill_color=g.vp['comm_infomap'],
                               vertex_halo=mark,
                               vertex_halo_color=[0.8, 0, 0, 0.6])
    win.add(win.graph)


def put_text(pixbuf, text, x, y):
    surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, pixbuf.get_width(),
                                 pixbuf.get_height())
    context = cairo.Context(surface)

    Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)
    context.paint()  # paint the pixbuf

    # add the text
コード例 #3
0
ファイル: MAIN.py プロジェクト: PercyLau/GraduateThesis
                         pos,
                         geometry=(1024, 800),
                         vertex_shape='hexagon',
                         vertex_size=10,
                         vertex_anchor=0,
                         vertex_pen_width=0,
                         edge_color=[1, 1, 1, 1],
                         vertex_fill_color=Cha)
else:
    count = 0
    win = Gtk.OffscreenWindow()
    win.set_default_size(1024, 1024)
    win.graph = gt.GraphWidget(g,
                               pos,
                               vertex_shape='hexagon',
                               vertex_size=10,
                               vertex_anchor=0,
                               vertex_pen_width=0,
                               edge_color=[1, 1, 1, 1],
                               vertex_fill_color=Cha)
    win.add(win.graph)

# TODO: main loop function is starting from here

# TODO: Gtk window end process is here
# Bind the function above as an 'idle' callback.
cid = GObject.idle_add(Update_GTK_State)
# We will give the user the ability to stop the program by closing the window.
win.connect("delete_event", Gtk.main_quit)

# Actually show the window, and start the main loop.
win.show_all()
コード例 #4
0
ファイル: anim-static.py プロジェクト: bio16/TP_especial
    win = gt.GraphWindow(g,
                         pos,
                         geometry=(500, 400),
                         edge_color=[0.6, 0.6, 0.6, 1],
                         vorder=visited,
                         vertex_fill_color=state,
                         vertex_halo=mark,
                         vertex_halo_color=[0.8, 0, 0, 0.6])
    print('asdasd', g.num_vertices())
else:
    win = Gtk.OffscreenWindow()
    win.set_default_size(500, 400)
    win.graph = gt.GraphWidget(g,
                               pos,
                               edge_color=[0.6, 0.6, 0.6, 1],
                               vorder=visited,
                               vertex_fill_color=state,
                               vertex_halo=mark,
                               vertex_halo_color=[0.8, 0, 0, 0.6])
    win.add(win.graph)


# This function will be called repeatedly by the GTK+ main loop, and we use it
# to update the state according to the dynamics.
def update_state():
    global time
    mark.a = False
    visited.a = False
    g.set_vertex_filter(None)

    # visit the nodes in random order
コード例 #5
0
    win = gt.GraphWindow(g,
                         pos,
                         geometry=(1024, 800),
                         edge_color=[0.6, 0.6, 0.6, 1],
                         vertex_fill_color=VertexState,
                         vertex_halo=mutate_tag,
                         vertex_halo_size=2,
                         vertex_halo_color=Yellow)
else:
    count = 0
    win = Gtk.OffscreenWindow()
    win.set_default_size(1024, 800)
    win.graph = gt.GraphWidget(g,
                               pos,
                               edge_color=[0.6, 0.6, 0.6, 1],
                               vertex_fill_color=VertexState,
                               vertex_halo=mutate_tag,
                               vertex_halo_size=2,
                               vertex_halo_color=Yellow)
    win.add(win.graph)

# TODO: main loop function is starting from here

# TODO: Gtk window end process is here
# Bind the function above as an 'idle' callback.
cid = GObject.idle_add(Update_GTK_State)
# We will give the user the ability to stop the program by closing the window.
win.connect("delete_event", Gtk.main_quit)

# Actually show the window, and start the main loop.
win.show_all()