[wxPython] Widget coordinates

Hi

I'm trying to draw something like a crossword on a widget, and to that
end, I'm using wxDC.DrawRectangle.

Suppose I want to draw 2 squares, side by side and such that they
overlap over a common edge. I would do something like this:

...
dc = wxPaintDC(self)
...
dc.DrawRectangle(0, 0,10,10)
dc.DrawRectangle(10,0,10,10)
...

i.e., draw 2 squares 10 pixels wide.

Now, If I print the drawing, the two squares are perfectly aligned; but
on screen it looks like the common edge is wider than the other edges.

On the other hand, if I do:

...
dc.DrawRectangle(0, 0,10,10)
dc.DrawRectangle(11,0,10,10)
...

then the squares looks ok on screen but not in paper :frowning:

In "Print Preview" mode, both methods looks ok on certain magnifications
and bad on others.

Perhaps I don't understand the meaning of DrawRectangle parameters;
let's see:

The statment DrawRectangle(100,100,10,10) should draw a rectangle
starting at pixels (100,100) and ending in (110,110), right?

Thus, If the pen is 1 pixel width and I draw another rectangle with
DrawRectangle(110,100, 10,10), then it should be a line 1 pixel wide
from (110,100) to (110,110), isn't it?

What should I do?

Thanks in advance.

    Juan Pablo

I recently sent a sample that doesn't seem to quite work.

I wrote it on Linux with Python 2.1 and wxPython 2.3.3 (I think)

I just tried it on my Windows box, and it didn't work right. I seem to
have left in a dependency on an extenal bitmap file. I have embedded the
bitmaps in the code, so you should be able to fix it. I'm about to leave
for the airport, so I can't fix it until next week. Good luck.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov