Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57464 > unrolled thread

Unlimited canvas painting program

Started bymarkotaht@gmail.com
First post2013-10-24 12:16 -0700
Last post2013-10-24 17:04 -0500
Articles 9 — 8 participants

Back to article view | Back to comp.lang.python


Contents

  Unlimited canvas painting program markotaht@gmail.com - 2013-10-24 12:16 -0700
    Re: Unlimited canvas painting program Thomas Murphy <thomasmurphymusic@gmail.com> - 2013-10-24 15:22 -0400
      Re: Unlimited canvas painting program markotaht@gmail.com - 2013-10-24 12:32 -0700
        Re: Unlimited canvas painting program MRAB <python@mrabarnett.plus.com> - 2013-10-24 21:02 +0100
          Re: Unlimited canvas painting program albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-11-07 11:30 +0000
            Re: Unlimited canvas painting program Chris Angelico <rosuav@gmail.com> - 2013-11-08 00:04 +1100
    Re: Unlimited canvas painting program Tim Chase <tim@thechases.com> - 2013-10-24 16:46 -0500
      Re: Unlimited canvas painting program Grant Edwards <invalid@invalid.invalid> - 2013-10-24 21:51 +0000
        Re: Unlimited canvas painting program Tim Chase <python.list@tim.thechases.com> - 2013-10-24 17:04 -0500

#57464 — Unlimited canvas painting program

Frommarkotaht@gmail.com
Date2013-10-24 12:16 -0700
SubjectUnlimited canvas painting program
Message-ID<5d107d11-0abf-4180-a994-3368f12979c1@googlegroups.com>
How to create a program similar to paint, but the difference would be that the cursor would be always in the middle and the canvas moves or the camera is always fixed on the cursor as it moves around the canvas. And the canvas should be infinite. What would be reasonable to use? 

In addition, i want it to draw a line whidout me having to press a button, just move the mouse.

Ill try to think a better way to describe, what i want, but for now i hope this is sufficient and clear enough.

[toc] | [next] | [standalone]


#57465

FromThomas Murphy <thomasmurphymusic@gmail.com>
Date2013-10-24 15:22 -0400
Message-ID<mailman.1476.1382642745.18130.python-list@python.org>
In reply to#57464
To start with, you'll want some sort of Graphic User Interface, a
popular and common (but not the only) one is TkInter, which you can
dive into here: https://wiki.python.org/moin/TkInter

[toc] | [prev] | [next] | [standalone]


#57466

Frommarkotaht@gmail.com
Date2013-10-24 12:32 -0700
Message-ID<9927d3d4-2038-4780-901b-fe3c1251af75@googlegroups.com>
In reply to#57465
So, i`ll take the canvas, somekind of mouse tracker, for each mouse location il draw a dot or 2X2 square or something. Main thing i have never understood, is how can i get the backround to move. 

Lets say ia hve 200X200 window. In the middle of it is the cursor that draws. If i move the mouse the cursor doesent move, but the canvas moves. So if i move mouse to the left, i get a line that goes to the left. So i probably must invert the canvas movement. If mouse goes left, canvas goes right. 

And if possible i would like to save my piece of art aswell :D

[toc] | [prev] | [next] | [standalone]


#57467

FromMRAB <python@mrabarnett.plus.com>
Date2013-10-24 21:02 +0100
Message-ID<mailman.1477.1382644948.18130.python-list@python.org>
In reply to#57466
On 24/10/2013 20:32, markotaht@gmail.com wrote:
> So, i`ll take the canvas, somekind of mouse tracker, for each mouse
> location il draw a dot or 2X2 square or something. Main thing i have
> never understood, is how can i get the backround to move.
>
> Lets say ia hve 200X200 window. In the middle of it is the cursor
> that draws. If i move the mouse the cursor doesent move, but the
> canvas moves. So if i move mouse to the left, i get a line that goes
> to the left. So i probably must invert the canvas movement. If mouse
> goes left, canvas goes right.
>
> And if possible i would like to save my piece of art aswell :D
>
I think it'll be confusing because it goes against how every other
program does it!

In a painting program you can point to other things, such as tools, but
if the cursor never moves...

It would be simpler, IMHO, if you just moved the canvas and stopped the
cursor going off the canvas when the user is drawing near the edge, so
that the user doesn't need to stop drawing in order to expose more of
the canvas.

[toc] | [prev] | [next] | [standalone]


#58642

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-11-07 11:30 +0000
Message-ID<527b79e0$0$1700$e4fe514c@dreader35.news.xs4all.nl>
In reply to#57467
In article <mailman.1477.1382644948.18130.python-list@python.org>,
MRAB  <python-list@python.org> wrote:
>On 24/10/2013 20:32, markotaht@gmail.com wrote:
>> So, i`ll take the canvas, somekind of mouse tracker, for each mouse
>> location il draw a dot or 2X2 square or something. Main thing i have
>> never understood, is how can i get the backround to move.
>>
>> Lets say ia hve 200X200 window. In the middle of it is the cursor
>> that draws. If i move the mouse the cursor doesent move, but the
>> canvas moves. So if i move mouse to the left, i get a line that goes
>> to the left. So i probably must invert the canvas movement. If mouse
>> goes left, canvas goes right.
>>
>> And if possible i would like to save my piece of art aswell :D
>>
>I think it'll be confusing because it goes against how every other
>program does it!
>
>In a painting program you can point to other things, such as tools, but
>if the cursor never moves...
>
>It would be simpler, IMHO, if you just moved the canvas and stopped the
>cursor going off the canvas when the user is drawing near the edge, so
>that the user doesn't need to stop drawing in order to expose more of
>the canvas.

A trick that is used in the editor I'm currently using is to do
normal cursor movement, until you are within a certain range from
the border. At that point you move the window over the canvas
in order to keep the cursor in the middle part of the canvas.
This can be done in discrete steps, and is not too disruptive.
Even if you do it continuously, it is more intuitive (but functionally
equivalent to) keeping the cursor in the middle.

A problem that remains is that a mouse is not intended for an infinite
canvas. At some point you will have to lift it and place it back on the
pad.

Groetjes Albert
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#58647

FromChris Angelico <rosuav@gmail.com>
Date2013-11-08 00:04 +1100
Message-ID<mailman.2125.1383829456.18130.python-list@python.org>
In reply to#58642
On Thu, Nov 7, 2013 at 10:30 PM, Albert van der Horst
<albert@spenarnc.xs4all.nl> wrote:
> A problem that remains is that a mouse is not intended for an infinite
> canvas. At some point you will have to lift it and place it back on the
> pad.

Only if you're talking about the physical grasp mouse, which is
probably the most common household mouse, or the touchpad, probably
the next most common. With a stick mouse (IBM calls it a TrackPoint),
you can carry on to infinity; same with a roller ball. But yes, a lot
of mouse designs aren't built for infinity.

ChrisA

[toc] | [prev] | [next] | [standalone]


#57472

FromTim Chase <tim@thechases.com>
Date2013-10-24 16:46 -0500
Message-ID<mailman.1482.1382651119.18130.python-list@python.org>
In reply to#57464
On 2013-10-24 12:16, markotaht@gmail.com wrote:
> How to create a program similar to paint, but the difference would
> be that the cursor would be always in the middle and the canvas
> moves or the camera is always fixed on the cursor as it moves
> around the canvas. And the canvas should be infinite. What would be
> reasonable to use? 

To hold an (effectively) infinite *bitmap* canvas, you'd (effectively)
need an (effectively) infinite amount of memory.  However, it could be
done with an (effectively) infinite *vector* canvas.  That way you
could limit the on-screen rendering to just the clipped subset of the
vector collection.

You'd still want to make it easy to toggle between "draw" and "stop
drawing", but you could make a mouse-click.

To implement, just pick a GUI library tkinter, wx, or whatver.

-tkc

[toc] | [prev] | [next] | [standalone]


#57474

FromGrant Edwards <invalid@invalid.invalid>
Date2013-10-24 21:51 +0000
Message-ID<l4c4ol$d5m$1@reader1.panix.com>
In reply to#57472
On 2013-10-24, Tim Chase <tim@thechases.com> wrote:
> On 2013-10-24 12:16, markotaht@gmail.com wrote:
>> How to create a program similar to paint, but the difference would
>> be that the cursor would be always in the middle and the canvas
>> moves or the camera is always fixed on the cursor as it moves
>> around the canvas. And the canvas should be infinite. What would be
>> reasonable to use? 
>
> To hold an (effectively) infinite *bitmap* canvas, you'd (effectively)
> need an (effectively) infinite amount of memory.

Sparse arrays allow it to be sort-of implemented as long as most of
the bitmap is "empty".

> However, it could be done with an (effectively) infinite *vector*
> canvas.

Sort of.  Eventually you run out of bits to hold the coordinates.

> That way you could limit the on-screen rendering to just the
> clipped subset of the vector collection.

The same can be done for a sparse array of bitmap subsets.

-- 
Grant Edwards               grant.b.edwards        Yow! I'm totally DESPONDENT
                                  at               over the LIBYAN situation
                              gmail.com            and the price of CHICKEN
                                                   ...

[toc] | [prev] | [next] | [standalone]


#57476

FromTim Chase <python.list@tim.thechases.com>
Date2013-10-24 17:04 -0500
Message-ID<mailman.1485.1382652159.18130.python-list@python.org>
In reply to#57474
On 2013-10-24 21:51, Grant Edwards wrote:
> > To hold an (effectively) infinite *bitmap* canvas, you'd
> > (effectively) need an (effectively) infinite amount of memory.  
> 
> Sparse arrays allow it to be sort-of implemented as long as most of
> the bitmap is "empty".

Fair enough.  Raw bitmap canvas eats memory like a ravenous dog.  But
a smarter sparse array would certainly ameliorate the problem well.

-tkc

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web