Skip to content

Commit c650082

Browse files
authored
GUI: 3.0 cleanup (#2371)
* Remove unlisted old examples * Fix scroll example * Inform about UIView in gui.concepts
1 parent 0ed4661 commit c650082

File tree

6 files changed

+14
-208
lines changed

6 files changed

+14
-208
lines changed

arcade/examples/gui/dropdown.py

Lines changed: 0 additions & 60 deletions
This file was deleted.

arcade/examples/gui/exp_scroll_area.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def __init__(self):
5858
h_scroll_area = UIBoxLayout(vertical=True, size_hint=(0.8, 0.8))
5959
content_right.add(h_scroll_area, anchor_x="center", anchor_y="center")
6060

61-
scroll_layout = h_scroll_area.add(UIScrollArea(size_hint=(1, 1)))
62-
scroll_layout.with_border(color=arcade.uicolor.WHITE_CLOUDS)
63-
scroll_layout.add(horizontal_list)
61+
h_scroll_layout = h_scroll_area.add(UIScrollArea(size_hint=(1, 1)))
62+
h_scroll_layout.with_border(color=arcade.uicolor.WHITE_CLOUDS)
63+
h_scroll_layout.add(horizontal_list)
6464

65-
h_scroll_area.add(UIScrollBar(scroll_layout, vertical=False))
65+
h_scroll_area.add(UIScrollBar(h_scroll_layout, vertical=False))
6666

6767
def on_key_press(self, symbol: int, modifiers: int) -> bool | None:
6868
if symbol == arcade.key.ESCAPE:

arcade/examples/gui/grid_layout.py

Lines changed: 0 additions & 79 deletions
This file was deleted.

arcade/examples/gui/side_bars_with_box_layout.py

Lines changed: 0 additions & 64 deletions
This file was deleted.

arcade/gui/experimental/scroll_area.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,13 @@ def do_layout(self):
196196
if new_rect != child.rect:
197197
child.rect = new_rect
198198

199+
total_min_x = round(total_min_x)
200+
total_min_y = round(total_min_y)
201+
199202
# resize surface to fit all children
200203
if self.surface.size != (total_min_x, total_min_y):
201204
self.surface.resize(
202-
size=(round(total_min_x), round(total_min_y)), pixel_ratio=self.surface.pixel_ratio
205+
size=(total_min_x, total_min_y), pixel_ratio=self.surface.pixel_ratio
203206
)
204207
self.scroll_x = 0
205208
self.scroll_y = 0

doc/programming_guide/gui/concepts.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ And disable it with :py:meth:`~arcade.gui.UIManager.disable()` within :py:meth:`
3535

3636
To draw the GUI, call :py:meth:`~arcade.gui.UIManager.draw` within the :py:meth:`~arcade.View.on_draw` method.
3737

38+
The :py:class`~arcade.gui.UIView` class is a subclass of :py:class:`~arcade.View` and provides
39+
a convenient way to use the GUI. It instanciates a :py:class:`~arcade.gui.UIManager` which can be accessed
40+
via the :py:attr:`~arcade.gui.UIView.ui` attribute.
41+
It automatically enables and disables the
42+
:py:class:`~arcade.gui.UIManager` when the view is shown or hidden.
43+
3844

3945
UIWidget
4046
````````

0 commit comments

Comments
 (0)