simple, old-style graphic ? 
Author Message
 simple, old-style graphic ?

Hello,

I'ld need a little suggestion :-)

For educational purposes I'ld find a python module (Windows platform) to
draw simple 2D graphic (even 3D if possible, but is not a requirement)
Like very old Basics, so lines, points, circles, rectangles, colors, simple
text strings, etc.

As last resort I thought about some OpenGL module but I would really prefer
something easier and simpler.

Have you some idea ?

I accept any hints and suggestions :)

Many thanks in advance!

--

bye!

Alessandro de Manzano
Playstos - TIMA SpA
Milano, Italy
http://www.*-*-*.com/



Sat, 26 Nov 2005 00:06:48 GMT  
 simple, old-style graphic ?
For 2D graphics, you might try PyGame, which is normally used for 2D (it
can support an OpenGL context as well, if you want to go that way
eventually).  It's fairly robust, has lots of sample code, and a
supportive community mailing list.  It's also got lots of support for
bitmap operations (including blended alpha IIRC), multimedia (sounds,
movies) and the like.  You can even, IIRC, find an
educationally-focussed module... "pygsear" (sp?) for it with a little
googling.

For starting off into 3D graphics, I'd suggest picking up one of the
scenegraph (also refered to as "retained mode") engines rather than
working directly in OpenGL (unless your goal is "learn OpenGL so I can
eventually write my own engine (or modify someone else's)", it's not a
good way to start doing graphics).  I like OpenGL (god help me), but
it's not a beginner-friendly programming system.

Enjoy,
Mike

Quote:


>>Sent: Monday, June 09, 2003 11:07 AM

>>Hello,

>>I'ld need a little suggestion :-)

>>For educational purposes I'ld find a Python module (Windows
>>platform) to draw simple 2D graphic (even 3D if possible,
>>but is not a requirement). Like very old Basics, so lines,
>>points, circles, rectangles, colors, simple text strings, etc.

>You can use Tkinter.Canvas, it does this, and plenty more.

>>As last resort I thought about some OpenGL module but I would
>>really prefer something easier and simpler.

...

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/



Sat, 26 Nov 2005 00:38:37 GMT  
 simple, old-style graphic ?
We are using Tkinter...

You can also take a look at:
http://matplotlib.sourceforge.net/

Vincent

Quote:
-----Original Message-----

Sent: Monday, June 09, 2003 12:07 PM

Subject: simple, old-style graphic ?

Hello,

I'ld need a little suggestion :-)

For educational purposes I'ld find a Python module (Windows platform) to
draw simple 2D graphic (even 3D if possible, but is not a requirement)
Like very old Basics, so lines, points, circles, rectangles, colors, simple
text strings, etc.

As last resort I thought about some OpenGL module but I would really prefer
something easier and simpler.

Have you some idea ?

I accept any hints and suggestions :)

Many thanks in advance!

--

bye!

Alessandro de Manzano
Playstos - TIMA SpA
Milano, Italy
http://www.playstos.com

--
http://mail.python.org/mailman/listinfo/python-list



Sat, 26 Nov 2005 00:33:59 GMT  
 simple, old-style graphic ?

Quote:

> Sent: Monday, June 09, 2003 11:07 AM

> Hello,

> I'ld need a little suggestion :-)

> For educational purposes I'ld find a Python module (Windows
> platform) to draw simple 2D graphic (even 3D if possible,
> but is not a requirement). Like very old Basics, so lines,
> points, circles, rectangles, colors, simple text strings, etc.

You can use Tkinter.Canvas, it does this, and plenty more.

Quote:

> As last resort I thought about some OpenGL module but I would
> really prefer something easier and simpler.

Planning on killing any ants with an H bomb this week?
:-)

Quote:

> Have you some idea ?

Tkinter.Canvas is good for you.

Quote:

> I accept any hints and suggestions :)

Hmmm... Tkinter.Canvas

*wink* *wink* *nudge* *nudge*
saynomore saynomore.

Quote:

> Many thanks in advance!

-gca
Advertencia:La informacion contenida en este mensaje es confidencial y
restringida, por lo tanto esta destinada unicamente para el uso de la
persona arriba indicada, se le notifica que esta prohibida la difusion de
este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
la transmision, favor de comunicarse con el remitente. Gracias.


Sat, 26 Nov 2005 00:11:08 GMT  
 simple, old-style graphic ?

[...]

Quote:
> For educational purposes I'ld find a Python module (Windows platform) to
> draw simple 2D graphic (even 3D if possible, but is not a requirement)
[...]
> As last resort I thought about some OpenGL module but I would really prefer
> something easier and simpler.

> Have you some idea ?

Never used it so I might be way off, but how about vtk?

http://www.imaging.robarts.ca/~dgobbi/vtk/vtkpython.html

John



Sat, 26 Nov 2005 06:56:07 GMT  
 simple, old-style graphic ?

Quote:
>Hello,

>I'ld need a little suggestion :-)

>For educational purposes I'ld find a Python module (Windows platform) to
>draw simple 2D graphic (even 3D if possible, but is not a requirement)
>Like very old Basics, so lines, points, circles, rectangles, colors, simple
>text strings, etc.

>As last resort I thought about some OpenGL module but I would really prefer
>something easier and simpler.

>Have you some idea ?

>I accept any hints and suggestions :)

Have you looked at the tkinter demos that come with the source distribution?
(the source distribution is worth downloading, if you haven't).

OTOH, I have posted a similar question in the past, and the itch is there.
I just haven't scratched yet ;-) Maybe the thing to do is prototype the desired
functionality as a class that makes hidden use of tkinter at first, and then
if desired write some extensions that provide the same class interface but use
minimal win32 windows and graphics functionality, perhaps by interfacing class
methods to the windows stuff running in a separate machine thread via queues and/or
shared memory with locks, etc. to pass data.

The advantage of prototyping using existing tkinter stuff is that you may not
need to reimplement unless you want to ;-)

Regards,
Bengt Richter



Sat, 26 Nov 2005 16:09:48 GMT  
 simple, old-style graphic ?

Quote:

> For educational purposes I'ld find a Python module (Windows platform) to
> draw simple 2D graphic (even 3D if possible, but is not a requirement)
> Like very old Basics, so lines, points, circles, rectangles, colors, simple
> text strings, etc.

> As last resort I thought about some OpenGL module but I would really prefer
> something easier and simpler.

> Have you some idea ?

> I accept any hints and suggestions :)

Maybe you can do something with Pygsear[0], built on top of the
Pygame[1] library, which is in turn built on top of SDL[2].

[0] http://www.nongnu.org/pygsear/
[1] http://www.pygame.org
[2] http://www.libsdl.org

yours,
Gerrit.

--
217. If he be the slave of some one, his owner shall give the physician
two shekels.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
        http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
        http://www.sp.nl/



Sat, 26 Nov 2005 18:46:13 GMT  
 simple, old-style graphic ?

Quote:
> Hello,

> I'ld need a little suggestion :-)

> For educational purposes I'ld find a Python module (Windows platform) to
> draw simple 2D graphic (even 3D if possible, but is not a requirement)
> Like very old Basics, so lines, points, circles, rectangles, colors, simple
> text strings, etc.

For educational purposes, there is always the good old turtle module in
the standard distribution (quite limited, but simple).

                      Michele



Sat, 26 Nov 2005 20:52:15 GMT  
 simple, old-style graphic ?


Quote:
> >I accept any hints and suggestions :)

> Have you looked at the tkinter demos that come with the source
distribution?
> (the source distribution is worth downloading, if you haven't).

No I have not yet looked at it.
I'll do, since many people kindly indicated it to me ;-)

Quote:
> minimal win32 windows and graphics functionality, perhaps by interfacing
class
> methods to the windows stuff running in a separate machine thread via
queues and/or
> shared memory with locks, etc. to pass data.

Yup, maybe a module/extension just over Win32 GDI functions, very "low
level" very custom, but definetely not easy nor quick to write ;-) :(

I'll take a look at TKinter and pyGame as seems to be the most quoted
approches for a problem like mine.

Many many thanks to you all ! :-)

--

bye!

Alessandro de Manzano
Playstos - TIMA SpA
Milano, Italy
http://www.playstos.com



Sat, 26 Nov 2005 21:12:01 GMT  
 simple, old-style graphic ?

Quote:

> I'd need a little suggestion :-)

> For educational purposes I'ld find a Python module (Windows platform) to
> draw simple 2D graphic (even 3D if possible, but is not a requirement)
> Like very old Basics, so lines, points, circles, rectangles, colors, simple
> text strings, etc.

> As last resort I thought about some OpenGL module but I would really prefer
> something easier and simpler.

> Have you some idea ?

is this simple enough?

from Tkinter import *

root = Tk()
root.title("WCK PixelCanvas")

canvas = PixelCanvas(root, background="white")
canvas.pack()

# create the pixmap!
canvas.update()

canvas.draw_line((0, 0, 100, 100), "red")
canvas.draw_line((0, 100, 100, 0), "blue", 10)
canvas.draw_rect((100, 100, 200, 200), "gold")
canvas.draw_ellipse((50, 50, 150, 150), "gold", "black")
canvas.draw_image((200, 100), PhotoImage(file="guido.gif"))
canvas.draw_text((100, 200), "WCK PixelCanvas", font="Helvetica 30")

root.mainloop()

where the PixelCanvas is defined as:

from WCK import Widget

class PixelCanvas(Widget):

    ui_option_width = 640
    ui_option_height = 480

    def __init__(self, master, **options):
        self.pixmap = self.size = None
        self.ui_init(master, options)

    def ui_handle_config(self):
        return int(self.ui_option_width), int(self.ui_option_height)

    def ui_handle_resize(self, width, height):
        if (width, height) != self.size:
            background = self.ui_brush(self.ui_option_background)
            pixmap = self.ui_pixmap(width, height)
            pixmap.rectangle((0, 0, width, height), background)
            if self.pixmap:
                pixmap.paste(self.pixmap)
            self.pixmap = pixmap
            self.size = width, height

    def ui_handle_clear(self, draw, x0, y0, x1, y1):
        pass

    def ui_handle_repair(self, draw, x0, y0, x1, y1):
        if self.pixmap:
            draw.paste(self.pixmap)
        else:
            background = self.ui_brush(self.ui_option_background)
            draw.rectangle((x0, y0, x1, y1), background)

    def draw_line(self, xy, stroke="black", stroke_width=1):
        if self.pixmap:
            if stroke: stroke = self.ui_pen(stroke, stroke_width)
            self.pixmap.line(xy, stroke)
            self.ui_damage()

    def draw_rect(self, xy, fill=None, stroke=None, stroke_width=1):
        if self.pixmap:
            if fill: fill = self.ui_brush(fill)
            if stroke: stroke = self.ui_pen(stroke, stroke_width)
            self.pixmap.rectangle(xy, fill, stroke)
            self.ui_damage()

    def draw_ellipse(self, xy, fill=None, stroke=None, stroke_width=1):
        if self.pixmap:
            if fill: fill = self.ui_brush(fill)
            if stroke: stroke = self.ui_pen(stroke, stroke_width)
            self.pixmap.ellipse(xy, fill, stroke)
            self.ui_damage()

    def draw_polygon(self, xy, fill=None, stroke=None, stroke_width=1):
        if self.pixmap:
            if fill: fill = self.ui_brush(fill)
            if stroke: stroke = self.ui_pen(stroke, stroke_width)
            self.pixmap.polygon(xy, fill, stroke)
            self.ui_damage()

    def draw_text(self, xy, text, fill="black", font="helvetica"):
        if self.pixmap:
            self.pixmap.text(xy, text, self.ui_font(fill, font))
            self.ui_damage()

    def draw_image(self, xy, image):
        if self.pixmap:
            self.pixmap.paste(self.ui_image(image), xy)

and the WCK library is available from:

    http://effbot.org/zone/wck.htm

</F>



Sun, 27 Nov 2005 01:30:18 GMT  
 simple, old-style graphic ?

Quote:
> where the PixelCanvas is defined as:

permalink (w. screenshot):

    http://effbot.org/zone/wck-pixelcanvas.htm

</F>



Sun, 27 Nov 2005 03:03:57 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Linkage conventions, the old style

2. Old Basic's INPUT command RealBasic Style???

3. old / new style Controls

4. Old-style Macrofunctions.

5. anyone got something to convert from old to new style Tkinter

6. Old XL graphics toolbar on Dyalog v.7 ???????????

7. Need Help Implimenting DOS-Style Menus in CVF Standard Graphics Program

8. T-style object system, simple source to

9. older computers are simpler and oftern quicker...

10. Ada on old and simple systems

11. simple graphic

12. *Simple* Graphics programming language?

 

 
Powered by phpBB® Forum Software