Re: some advice about pictures in graphics

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
On Jan 30, 2020, at 5:29 PM, Nathan smith <[email protected]> wrote:
> 
> I was thinking perhaps of using the grid sizer object for this, and using that to create a table that is 7 10 columns and 5 rows, then positioning the cards upon this.
> Does grid sizer show lines though? I would not want that.

Sizers are not visible.  They are strictly used to arrange and position other windows.


> Is there a way to make sure, through wx python, all my images are the same size?

Presumably you would know that before you start.  One of the best imaging packages is Pillow, a reimplementation of the Python Imaging Library (PIL).  You would do:

    from PIL import Image
    x = Image.open(‘xxx.png’)
    print( x.size )

The problem with a grid is that the vertical columns end up being pretty long.  That’s why the solitaire apps usually show the card piles as overlapping.


> Further, if I wanted to shhow where the user is focused, is there a way to put a dot on a picture?

Of course.  After you copy the image to the screen, you can do whatever drawing you want.


> How could I make black rectangles that could later be replaced with card images?

You can either use a graphics app like Photoshop or Gimp to create your empty space image, and then treat it exactly like your card images, or just draw to the image box with standard drawing calls.


> Finally, what would be the recommended way to show that a card has been selected, is there a way in wx python to change the colour of the image? Should I instead change the background?

There are lots of ways.  An image doesn’t have a background color, but you can certainly draw the “negative” of the card.

There are surely lots of card game Python tutorials to get you started.  Start off by drawing some cards and moving them around, before you get into the mechanics of the game.
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/825F349C-D9DC-4D1C-9310-9A7D36B011A6%40probo.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.