[Tutor] plotting pixels
Bill Allen
wallenpb at gmail.com
Sat Sep 18 23:46:23 CEST 2010
On Sat, Sep 18, 2010 at 1:18 PM, Ken Oliver <ksterling at mindspring.com>wrote:
>
>
>> On Fri, Sep 17, 2010 at 3:38 AM, Alan Gauld <alan.gauld at btinternet.com>wrote:
>>
>>>
>>> For plotting pixels I would not use turtle graphics.
>>> That would be a fairly complicated option I'd have thought.
>>> A simple canvas would be easier.
>>>
>>> Alan G.
>>>
>>>
>> Oh, I see! I did not realize that Tk had a canvas widget. That is nice.
>> I will have to play with that and see if I can get everything done in the
>> code I am working with. What I am doing is just trying to do a simple
>> Mandelbrot set plot. It is another bit of coding that I do when learning a
>> new language to get a handle on some of the graphics capabilities, and I am
>> to that point.
>>
>> -Bill
>>
> It appears that the Tk canvas widget does not support simply plotting a
> pixel. However, I can plot a line only one pixel long. I wonder why they
> do not simply provide the pixel plot primitive? I have seen very many
> graphics packages that do this and I have always wondered why. The
> primitive obviously exists in the underlying code, because that is what
> everything else is built upon. Does Tk actually have a something like a
> create_pixel method in the canvas widget that I have missed?
>
> -Bill
>
> Is it naive of me to ask, "Couldn't one write his own plotpixel( ) function
> using the line() function?"
>
> .
>
> No, not naive at all. Indeed I could, but that is not the issue in my
mind. My point is that it seems strange to me that any graphics package
would not make the most basic of the routines, ploting a single pixel,
available. I think I actually see a way of doing it with the bitmap class,
but that is not the point. While I could do exactly as you have said, I
would rather either write my own low-level code to accomplish that or use a
package that does provide it than to wrap up a higher end function, such as
drawing a line or rectangle, into even more code in order to do less. For
the particular use that I am going to put this to, a package such as pygame
which does provide the ability to plot pixels directly will be more
suitable.
-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100918/bf181383/attachment-0001.html>
More information about the Tutor
mailing list