pygex - v0.3.3
Code from preview
import pygame
import pygex
window = pygex.Window(fps_limit=120)
fullscreen_toast = pygex.Toast('To exit full screen press [F11]')
debug_panel = pygex.DebugPanel(is_demonstration_mode=False)
some_textview = pygex.gui.TextView(
'Where is the incredible GUI kit for pygame? Right here is pygex!',
size=(pygex.gui.SIZE_MATCH_PARENT,) * 2,
text_line_spacing=10,
text_align=pygex.gui.ALIGN_CENTER,
content_gravity=pygex.gui.GRAVITY_CENTER,
text_color=pygex.color.COLOR_WHITE,
font_or_font_size=55,
background_drawable_or_color=pygex.gui.drawable.GradientDrawable(
pygex.color.GRADIENT_WITCHING_HOUR[::-1]
)
)
window.add_view(some_textview)
debug_panel.apply_on_screen()
if debug_panel.is_demonstration_mode:
from pygex.surface_recorder import SurfaceRecorder
surface_recorder = SurfaceRecorder(window.size, window.fps_limit)
window.resizable = False
while True:
window.render_views()
if window.input.is_up(pygame.K_F1):
window.take_screenshot()
elif window.input.is_up(pygame.K_F11):
window.fullscreen = not window.fullscreen
if window.fullscreen:
fullscreen_toast.show()
else:
fullscreen_toast.cancel()
elif window.input.is_up(pygame.K_F5) and debug_panel.is_demonstration_mode:
if surface_recorder.is_recording:
surface_recorder.pause_record()
surface_recorder.save()
window.show_toast('Record stopped and saved!')
else:
surface_recorder.start_record()
window.show_toast('Record started!')
window.flip()
if debug_panel.is_demonstration_mode:
surface_recorder.process_frame(window.surface)
What's new?
- The move from
pygame
topygame-ce
for better experience - New DebugPanel widget for displaying debug information
- Refactor Hint:
- Now it is displayed on top of the entire render and interface (like Toast).
- A more correct and convenient programming interface for implementing it.
- Other changes
- Refactor Views:
- Fixed a bug when changing visibility from any to GONE or vice versa, the corresponding changes did not affect the parent in any way. The same applies to changing padding and margin values
- Fixed bug with no update background surface after content surface size has changes
- Other changes
- Fixed cyclic import for Window, Input, Mouse due to the use of the broker module
- Other changes
Install this release
pip install https://github.com/aratakileo/pygex/archive/refs/tags/v0.3.3.zip
for windows
py -m pip install https://github.com/aratakileo/pygex/archive/refs/tags/v0.3.3.zip
for unix
/macos
python3 -m pip install https://github.com/aratakileo/pygex/archive/refs/tags/v0.3.3.zip