allenfrostline / Poker

Poker: A Simple Poker GUI in Python
15 stars 2 forks source link

Missing Window Icon + not sure how to play #3

Open MikeTheWatchGuy opened 5 years ago

MikeTheWatchGuy commented 5 years ago

When I see the window, I see the default tkinter icon.

After I see this screen, I don't seem to be able to do anything, at least nothing I click seems to do anything. I'll read through the code a bit and see what I'm missing.

image

allenfrostline commented 5 years ago

Well that's strange. Perhaps something to do with Windows. Thanks for help though :)

MikeTheWatchGuy commented 5 years ago

There is not poker.icns file in the resource folder on GitHub, thus it won't be loading anything as the icon as shown in this statement:

        window = sg.Window(window_title, icon=absPath('resources/poker.icns'), size=(564, 270 + 40 * (n_players - 2)), disable_close=True,
allenfrostline commented 5 years ago

Fixed.

MikeTheWatchGuy commented 5 years ago

Hmmm... I don't see it in the GitHub folder that I'm looking at (and the code from what I can tell):

image

Also, is there something that I can click on, etc, to play the game or is this missing icon causing problems blocking me?

allenfrostline commented 5 years ago

Weird... I see the icns file uploaded to root dir of this repo on my computer. Perhaps a refresh of the page will help?

The game view you just posted above is supposed to be, when on a Mac, just like the screenshot you can see in README. So there will be several buttons.

MikeTheWatchGuy commented 5 years ago

I see, you uploaded to root, but the code expects in resources so I copied there.

It didn't matter in the end as .icns is not a valid file format for windows. Can you supply it as a PNG or a GIF? This will allow it to go cross-platform. Or, perhaps better yet, making it into a base64 variable that is a permanent part of your code (assuming it's in the right format).

Do you see the default PySimpleGUI Icon when you run the program without setting your icon?

MikeTheWatchGuy commented 5 years ago

Oh, I see the diff now with the readme... there are no buttons on the Windows version.

MikeTheWatchGuy commented 5 years ago

The problem was that you're manually setting the size of your window. This had the effect of slicing off the bottom portion of the window.

Something about that calculation seems off. Your Output element looks crazy too with a size of 1150,5. That's 1150 characters wide.

MikeTheWatchGuy commented 5 years ago

After changing the Output Element size and the Text size for the "Game 1", the window "naturally sized" to the size it wanted to be which was this: image

So, it's closer.

MikeTheWatchGuy commented 5 years ago

With a border width of zero and no title, I don't understand the purpose of the Frame Element that's being used with the buttons. You can simply put the buttons on the same row and get the same effect. You're doing a lot of manual padding of the buttons anyway. That's what's pushing the "Call button" over which pushes everything else.

allenfrostline commented 5 years ago

Exactly. I've been spending a lot of time with all those padding... I'm still not quite familiar with all those units of element sizes (some are in pixels and the rest in characters).

allenfrostline commented 5 years ago

Also, it's strange as the window shows well on Mac. The buttons were fine there.

MikeTheWatchGuy commented 5 years ago

Element sizes are pretty much always in Characters, Rows.

Padding is in Pixels

Some ports of PySimpleGUI you can specify both in the size field, but not in the tkinter one. Newer ports have a size_px parameter if you want to specify the size in pixels, but again, not something in tkinter version.