Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
6b9f07b8
Commit
6b9f07b8
authored
Apr 30, 2013
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix animation demo problem with newer gobject
parent
36f45f5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
doc/demos/animation_dancing.py
doc/demos/animation_dancing.py
+2
-3
doc/demos/animation_sirs.py
doc/demos/animation_sirs.py
+2
-3
doc/demos/animation_zombies.py
doc/demos/animation_zombies.py
+5
-6
No files found.
doc/demos/animation_dancing.py
View file @
6b9f07b8
...
...
@@ -16,8 +16,7 @@ seed(42)
seed_rng
(
42
)
# We need some Gtk and gobject functions
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
import
gi._gobject
as
gobject
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
,
GObject
# We will generate a small random network
g
=
random_graph
(
150
,
lambda
:
1
+
poisson
(
5
),
directed
=
False
)
...
...
@@ -100,7 +99,7 @@ def update_state():
# Bind the function above as an 'idle' callback.
cid
=
go
bject
.
idle_add
(
update_state
)
cid
=
GO
bject
.
idle_add
(
update_state
)
# We will give the user the ability to stop the program by closing the window.
win
.
connect
(
"delete_event"
,
Gtk
.
main_quit
)
...
...
doc/demos/animation_sirs.py
View file @
6b9f07b8
...
...
@@ -22,8 +22,7 @@ seed(42)
seed_rng
(
42
)
# We need some Gtk and gobject functions
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
import
gi._gobject
as
gobject
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
,
GObject
# We will use the network of network scientists, and filter out the largest
# component
...
...
@@ -138,7 +137,7 @@ def update_state():
# Bind the function above as an 'idle' callback.
cid
=
go
bject
.
idle_add
(
update_state
)
cid
=
GO
bject
.
idle_add
(
update_state
)
# We will give the user the ability to stop the program by closing the window.
win
.
connect
(
"delete_event"
,
Gtk
.
main_quit
)
...
...
doc/demos/animation_zombies.py
View file @
6b9f07b8
...
...
@@ -23,8 +23,7 @@ seed(42)
seed_rng
(
42
)
# We need some Gtk and gobject functions
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
import
gi._gobject
as
gobject
from
gi.repository
import
Gtk
,
Gdk
,
GdkPixbuf
,
GObject
# We will use the karate-club network
g
=
collection
.
data
[
"karate"
]
...
...
@@ -54,9 +53,9 @@ state = g.new_vertex_property("int")
state
.
a
=
S
# Images used to draw the nodes. They need to be loaded as cairo surfaces.
Simg
=
cairo
.
ImageSurface
.
create_from_png
(
open
(
"face-grin.png"
,
"rb"
)
)
Simg_fear
=
cairo
.
ImageSurface
.
create_from_png
(
open
(
"face-surprise.png"
,
"rb"
)
)
Iimg
=
cairo
.
ImageSurface
.
create_from_png
(
open
(
"zombie.png"
,
"rb"
)
)
Simg
=
cairo
.
ImageSurface
.
create_from_png
(
"face-grin.png"
)
Simg_fear
=
cairo
.
ImageSurface
.
create_from_png
(
"face-surprise.png"
)
Iimg
=
cairo
.
ImageSurface
.
create_from_png
(
"zombie.png"
)
vertex_sfcs
=
g
.
new_vertex_property
(
"object"
)
for
v
in
g
.
vertices
():
...
...
@@ -153,7 +152,7 @@ def update_state():
# Bind the function above as an 'idle' callback.
cid
=
go
bject
.
idle_add
(
update_state
)
cid
=
GO
bject
.
idle_add
(
update_state
)
# We will give the user the ability to stop the program by closing the window.
win
.
connect
(
"delete_event"
,
Gtk
.
main_quit
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment