Sounds like you want to use cairo.
Here's a link to a pyCairo tutorial/diagram/overview I created that might help
you. There are also good examples on the cairo website under the cookbook.
http://www.akaafrica.com/wiki_new/index.php/CairoTutorial:The_files_are_here
\d
Fonty Python and other
I'm not sure this will help, but I use this code in a function I call when I
want to force a redraw. It makes the expose event happen.
self.alloc = self.get_allocation()
rect = gtk.gdk.Rectangle(self.alloc.x, self.alloc.y, self.alloc.width,
self.alloc.height)
self.window.invalidate_rect(rect,
Nathaniel,
Thanks for your response. I will try to better explain:
What do you mean by out of synch? Why is it so urgent that the
redraw happen quickly?
I mean that *if* the expose event takes too long to run, the loop may have
begun again and the state of the app will have changed.
I am
Hi,
I am stuck on this and thought it may have been lost in the noise, or didn't
reach the list. Can anyone give me a suggestion?
repost:
What do you mean by out of synch? Why is it so urgent that the
redraw happen quickly?
I mean that *if* the expose event takes too long to run, the loop
Hi,
I have a timeout calling a function that handles my animation.
Within that I have a call to _draw():
def _draw():
self.alloc = self.get_allocation()
rect = gtk.gdk.Rectangle(self.alloc.x, self.alloc.y, self.alloc.width,
self.alloc.height)
self.window.invalidate_rect(rect, True)
This
Is there some generic format format that works on both windows and linux
based systems?
I'd stick to HTML. Write your pages in normal HTML with images etc Then
experiment -- can you popup a browser? Perhaps you can find a way to display
HTML pages in a GTK window - I know wxPython has that
Nice guys post their solution so that next searches on that topic
won't bring answers like yours, which is equivalent to Hey guys, I
know how to do it but I won't tell you.
I was just thinking the same thing ;)
/d
___
pygtk mailing list
if your object can describe itself as a polygon, you can use a point
in polygon test. matplotlib provides some code to do this which is
extremely fast.
Thanks. I solved this a few days ago. I understand the concept behind the
point in poly (so clever!) but the implementation is a black box to
If you want to implement yet another canvas (please don't) have a look
at the source code of a good canvas and get inspiration (and code)
from there.
Well, the reason I asked in this list was to garner suggestions based on
PyGTK. So far the canvases I've looked at are in C. But I'll take your
What you're looking for is, for some reason or another, known as a
canvas.
Okay. It seems I am writing my own canvas then. I am stuck on GTL+2.8 for a
bunch of reasons so I have not been able to run any of the popular canvas
apps.
People on the list might have suggestions for sorting
Hello,
I have a rudimentary app going that draws cairo commands down onto a
gtk.DrawingArea. On each loop they pile up, like so many pixels.
I want to be able to bring life to each shape (rep by an object internally)
such that they:
* detect mouse enter/leave
* detect mouse clicks
* detect key
Hi, not sure if this is the appropriate list.
Can one, within a single cairo context, do this:
while True:
ctx.translate(0,0)
pycairo commands to draw a square at 0,0
ctx.translate(10,10)
pycairo commands to draw a circle at 0,0
ctx.translate(50,50)
pycairo commands to draw a Black
Yes, definitely the right list. Welcome, Donn!
Thanks. Having fun so far!
What you're looking for is save/restore, like so:
Excellent. Saved!
Often I will code all of my draw_something functions to also call
save() at the beginning and restore() at the end, which helps them to
act
Hi again,
I have poked-around the net, but not found a simple example to:
1. Open an svg file
2. Draw it to a gtk.DrawingArea
I am also confused about how that would/would not fit into pycairo - is cairo
used to draw the svg, or is it done directly by something else?
Is there any way to get
To 'display' the SVG file in a gtk.DrawingArea is quite simple. Just use
the Cairo source_pixbuf .
So you are saying that an svg gets displayed as a bitmap of some kind?
I checked your code and don't see anything to do with svg, but it's fill of
clues. Thanks so far :)
\d
for various reasons I want to migrate the whole thing
over to an environment with better GUI support.
I'm sure you know, but just in case -- there are some very cool gui's written
to run directly in pygame. I can't remember the name, but one is particularly
good. Ocemp or Ocean rings a bell.
Hi,
I want to try and draw a series of cairo shapes in a loop that does other
stuff like:
while True:
canvas.draw()
updateStuff()
checkStuff()
How do I fit this concept together with the gtk.main() that seems to stop
there? Am I looking at some kind of timeout() command?
\d
you have to do background work like this one, you need some kind of
multithreading.
Blimey. I have managed to get this far in life without ever looking at
threads. I suppose it's high time ...
Thanks for the link.
\d
___
pygtk mailing list
That's not the only way. You can use gobject.timeout_add()
to arrange for a function to be called at regular intervals.
That function can then do whatever the body of your while
loop would have done.
Thanks again Greg, simplicity to the rescue :)
\d
Greg, thanks for the feedback. This is a little long, so I hope you get the
time to read it. I'll understand if you back quickly away from it and saunter
off whistling :)
I'm shooting for something seemingly impossible on Linux, and yet there are
some tantalizing projects that approach it.
Hello,
I am *really* new to GTK and company and I am snowed-under by the bewildering
array of classes. For example, I really can't figure out how to look for the
classes I need, they all sort of look the same!
I am reading the main tutorial, but the way I work is to aim for something: I
want
You want a gtk.Layout. It lets you place widgets at explicit
positions in a 32-bit coordinate system and can be scrolled.
Thanks for the tip. I'm not getting closer. If you have a moment, could you
look at this code?
\d
#!/usr/bin/env python
import gtk
import math
class
Hey Abel!
The difference is this: If property.name has the value 'foo', then
getattr(self, property.name) is equivalent to getattr(self, 'foo'),
Ah, I didn't spot that. Subtle. Thanks.
/d
--
If there is anyone in the audience who believes in telekinesis, please raise
my hand!
-- James Randi
23 matches
Mail list logo