-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
Vfill widget #403
Vfill widget #403
Conversation
Codecov Report
@@ Coverage Diff @@
## master #403 +/- ##
==========================================
+ Coverage 97.23% 97.24% +0.01%
==========================================
Files 48 49 +1
Lines 12104 12155 +51
==========================================
+ Hits 11769 11820 +51
Misses 335 335
Continue to review full report at Codecov.
|
Can you merge the master into this branch, so I can try the code with the border size improvements? |
Done 💯 |
It seems that the width of I think that vertical alignment widgets should always have 0 width (or 1 if that is not supported). I am not sure if that affects other parts of the library. |
Are you resizing the widgets? Because in tests, the following (without any further change) is true: menu = MenuUtils.generic_menu()
b = menu.add.button('nice')
vf1 = menu.add.vertical_fill()
self.assertEqual(vf1.get_width(), 0) |
Hum, if I print the size of each widget I obtain:
where the 0's are the However, |
Can you provide a minimal working example? The following works as expected, thus, I cannot reproduce your issue: menu = MenuUtils.generic_menu()
b = menu.add.button('nice') # Add button
self.assertEqual(menu.get_size(widget=True), b.get_size())
# Now add 1 vfill, this should use all available height
vf1 = menu.add.vertical_fill()
self.assertEqual(vf1.get_width(), 0)
self.assertEqual(menu.get_size(widget=True), (b.get_width(), b.get_height() + vf1.get_height())) |
@vnmabus are you using a column/row layout? |
Nope. |
Then I need an example. Maybe this widget introduces a bug, or you have spotted a new bug |
The problem DOES NOT OCCUR if I remove |
So, this is a minimal working example: import pygame
import pygame_menu
pygame.init()
surface = pygame.display.set_mode((800, 600))
theme = pygame_menu.Theme(
widget_alignment=pygame_menu.locals.ALIGN_LEFT,
)
menu = pygame_menu.Menu(
"",
800,
600,
center_content=True,
theme=theme,
)
# Now add 1 vfill, this should use all available height
vf1 = menu.add.vertical_fill()
print(menu.get_size(widget=True))
b = menu.add.button('nice') # Add button
print(menu.get_size(widget=True), b.get_size())
# Now add 1 vfill, this should use all available height
vf2 = menu.add.vertical_fill()
print(menu.get_size(widget=True), b.get_size()) |
@vnmabus I've fixed the issue (and added the tests!). The problem was I overwrote Let me know your thoughts 😎 . Greetings! |
This fixes it, thanks!! |
I'll merge to master then. Let me know about anything else. If you need, I can publish a new PyPI version |
Can you publish in PyPI? I have to make a PR and need to upgrade the dependency to your package. |
Done! See https://github.com/ppizarror/pygame-menu/releases/tag/4.2.7, https://pypi.org/project/pygame-menu/ |
VFill
, Is there a way to make the widgets use all available vertical space? #400.