UICollectionIter - enable looping over scene ui / children objects #28

Closed
opened 2024-03-09 18:58:55 +00:00 by john · 1 comment
Owner

33 feat: UICollectionIter - enable looping over scene ui / children objects

Compare with #26

33 feat: UICollectionIter - enable looping over scene ui / children objects Compare with #26
john removed this from the The Datatype Overhaul project 2024-03-13 13:11:41 +00:00
Author
Owner
>>> ui = mcrfpy.sceneUI("uitest")
>>> ui
<UICollection (3 objects: 1 Frame, 1 Caption, 1 Grid)>
>>> for c in ui:
...   print(c)
... 
<Frame (x=100, y=150, w=400, w=400, outline=0, fill_color=(255, 0, 0, 255), outline_color=(255, 255, 255, 255), 1 child objects)>
<Caption (x=50, y=250, text='Hello World.', outline=0, fill_color=(255, 255, 255, 255), outline_color=(0, 0, 0, 255), )>
<Grid (x=550, y=150, w=200, h=200, center=(32, 32), zoom=2)>
>>> for c in ui[0].children:
...   print(c)
... 
<Frame (x=50, y=50, w=200, w=200, outline=0, fill_color=(0, 255, 0, 255), outline_color=(255, 255, 255, 255), 1 child objects)>
>>> for c in ui[0].children[0].children:
...   print(c)
... 
<Frame (x=5, y=5, w=100, w=100, outline=0, fill_color=(0, 0, 255, 255), outline_color=(255, 255, 255, 255), 2 child objects)>
>>>
``` >>> ui = mcrfpy.sceneUI("uitest") >>> ui <UICollection (3 objects: 1 Frame, 1 Caption, 1 Grid)> >>> for c in ui: ... print(c) ... <Frame (x=100, y=150, w=400, w=400, outline=0, fill_color=(255, 0, 0, 255), outline_color=(255, 255, 255, 255), 1 child objects)> <Caption (x=50, y=250, text='Hello World.', outline=0, fill_color=(255, 255, 255, 255), outline_color=(0, 0, 0, 255), )> <Grid (x=550, y=150, w=200, h=200, center=(32, 32), zoom=2)> >>> for c in ui[0].children: ... print(c) ... <Frame (x=50, y=50, w=200, w=200, outline=0, fill_color=(0, 255, 0, 255), outline_color=(255, 255, 255, 255), 1 child objects)> >>> for c in ui[0].children[0].children: ... print(c) ... <Frame (x=5, y=5, w=100, w=100, outline=0, fill_color=(0, 0, 255, 255), outline_color=(255, 255, 255, 255), 2 child objects)> >>> ```
john closed this issue 2025-07-11 17:49:26 +00:00
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#28
No description provided.