Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] New Qt UI (pyqt6) #756

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

[WIP] New Qt UI (pyqt6) #756

wants to merge 11 commits into from

Conversation

Debilski
Copy link
Member

@Debilski Debilski commented May 16, 2023

Adding another work-in-progress PR for a different UI toolkit. This time PyQt6. Please see below for graphics.

I am undecided if we should really push this one and completely replace our old Tk design, but I have at least brought it into a workable state now. (I think the ghosts are still a little short and need a bit of a stretch.)

The advantages of Qt would be:

  • Can do threading: We can receive zmq messages in a background thread and notify the app
  • Much easier to do graphics: automatically scales all elements to the size that is needed
  • Anti-aliasing
  • Can easily export to PNG
  • Does have an animation framework but I haven’t tested it yet.
  • Might be easier to implement new features
  • Alpha channel: Ghosts could be slightly transparent so that food shines through them

Similarly to Tk:

  • I had hoped that we’d also be able to just write html+css for the text in the header and status but that doesn’t seem to be possible. So this part looks just like it used to.
  • Styling of buttons is possible but they lose their native look.

Disadvantages:

  • Not all features yet
  • Needs more dependencies
  • Not sure if it will run everywhere
  • We might have to support both Qt and Tk for some time (maybe forever)
  • PyQt6 and PySide are competing frameworks. In principle they might both work but this needs a small compatibility layer (mainly for imports)
  • We got used to the old, rough look (and on macOS it is actually fine – see below for the faux 3d chin of Pacman)

Virtualenv Qt6

Virtualenv qt

Conda Qt6 (disclaimer: I only tested the version that pip would install)

Conda qt

In comparison, these show the differences/problems with Tk:

Conda Tk (no anti-aliasing)

Conda tk

Virtualenv Tk (anti-aliasing in text but not in graphics)

Virtualenv tk

macOS Tk (does anti-aliasing but look at the colour of the buttons)

macOS tk

Detail (Faux 3d out of nowhere – although this actually looks cool)

Pacman with chin

@Debilski
Copy link
Member Author

The possibilities are endless Screenshot from 2023-05-19 14-30-13

@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Merging #756 (8eacad7) into main (aef2fe1) will decrease coverage by 0.62%.
The diff coverage is 11.53%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #756      +/-   ##
==========================================
- Coverage   85.72%   85.11%   -0.62%     
==========================================
  Files          21       21              
  Lines        2354     2378      +24     
==========================================
+ Hits         2018     2024       +6     
- Misses        336      354      +18     
Files Changed Coverage Δ
pelita/game.py 81.91% <11.53%> (-4.59%) ⬇️

... and 1 file with indirect coverage changes

@otizonaizit
Copy link
Member

The possibilities are endless Screenshot from 2023-05-19 14-30-13

that's called cultural appropriation or racial and ethnic stereotype, you choose ;-)

@Debilski
Copy link
Member Author

I got the idea from a tequila bottle. I’m innocent here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants