<br><br><div class="gmail_quote">On Sat, Sep 18, 2010 at 9:26 PM, Bill Allen <span dir="ltr">&lt;<a href="mailto:wallenpb@gmail.com">wallenpb@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;">

<br>Digging a little deeper it seems the idiomatic way to do this in Python <br>is to use PIL the Python Imaging Library to create a GIF or bitmap <br>image and then insert that into Tkinters cancvas as an image object.<br>

<br>The Pil ImageDraw class has a point() ethod<br><br>I&#39;ve never tried this but it is described in Grayson&#39;s (now out of print?) <br>book on Tkinter where he uses it to draw a Mandelbrot....<br>The book may be available online these days...<br>

<br>Nowdownloadall.com seems to have it although I&#39;ve no idea <br>of the legality of it!<br><br>HTH,<br><br>Alan G.<br></div></div></blockquote></div><div>Yes, to create a gif or a bmp from the iteration results and then to display that at the end of the run is by far the most efficient way of producing Mandelbrot and related sets.  I have actually done it that way before.   I just have always had a strange preference to see the set as it is being produced, which is far from efficient.  Kind of a very elaborate progress bar!  Anyway, I have no real complaints about the Tk canvas methods.  It has always just been a pet peeve of mine when something as basic and simple as plotting a pixel is missing.  My complaint on this goes way back to the ancient days when I had to figure out how to write a plot_pixel primitive in x86 assembler and then build a graphics library of my own so I could have pixel based graphics on my old monochrome IBM XT clone that had a Hercules graphics card in it.  Those were the days!  Mandelbrot sets in 4 shades of amber-monochrome!    ;-)   I will check out that book you referenced.   I appreciate everybody&#39;s feedback on this.<br>

<br>-Bill<br><br></div></div><br></blockquote><div>I found this code on the web.  It creates a 100x100 tk.photoimage  and fills it with a radom colored pixels then displays it.  It seems to me that I should be able to adapt this to what I am trying to acomplish.  The only difference in the way I am filling the tk.photoimage object.  I ran this under Python 3.1.2 with success.  I believe the &#39;#%02x%02x%02x&#39; is the format for an image.   It is a color photoimage, but I am presuming that if written directly out to a file this would not actually produce a valid, bmp, gif, pgn, etc.  Correct?   This does seem to be a reasonable solution that is a pure Tk solution.  Also it works in Python 3x, whereas the PIL library has not yet been released for 3x.   I have not mentioned it before, but using Python 3x only is also one of my requirement, though self-imposed.  Can anyone help me better understand this part of the code below?   self.i.put(&#39;#%02x%02x%02x&#39; % tuple(color),(row,col))<br>
<br>import tkinter, random<br>class App:<br>    def __init__(self, t):<br>        self.i = tkinter.PhotoImage(width=100,height=100)<br>        colors = [[random.randint(0,255) for i in range(0,3)] for j in range(0,10000)]<br>
        row = 0; col = 0<br>        for color in colors:<br>            self.i.put(&#39;#%02x%02x%02x&#39; % tuple(color),(row,col))<br>            col += 1<br>            if col == 100:<br>                row +=1; col = 0        <br>
        c = tkinter.Canvas(t, width=100, height=100); c.pack()<br>        c.create_image(0, 0, image = self.i, anchor=tkinter.NW)<br><br>t = tkinter.Tk()<br>a = App(t)    <br>t.mainloop()<br><br><br><br></div></div><br>