Describe the bug
When a widget is unpacked then repacked, it is misplaced and merges with other widgets in the frame.
To Reproduce
Execute this code then press on the "Do issue" button
import pygame_menu
import pygame
from pygame_menu.examples import create_example_window
#creating window
surface = create_example_window("window", (800,600))
#creating menu
menu = pygame_menu.Menu("menu", 800, 600, theme=pygame_menu.themes.THEME_DARK)
#creating a frame filling the menu to store the window content horizontally
frame0 = menu.add.frame_h(800, 540, padding=0)
#left frame, dark grey
frame1 = menu.add.frame_v(400, 540, background_color=(50,50,50), padding=0)
frame0.pack(frame1)
#right frame, light grey
frame2 = menu.add.frame_v(400, 540, background_color=(100,100,100), padding=0)
frame0.pack(frame2)
#a text label into frame1
label = menu.add.label("some title here")
frame1.pack(label,align=pygame_menu.locals.ALIGN_CENTER)
#a yellow image just under the label
srf = pygame.Surface((50,50))
srf.fill((255,255,0))
image = menu.add.surface(srf)
frame1.pack(image,align=pygame_menu.locals.ALIGN_CENTER)
#this one will never be unpacked
notmoving = menu.add.label("no i'm not moving")
frame1.pack(notmoving,align=pygame_menu.locals.ALIGN_CENTER)
#this function is supposed to unpacking then repacking the frames into frame1 with same configuration as before
def issue():
frame1.unpack(label)
frame1.unpack(image)
#I want to do some stuff here that requires frame0 to have no children
frame1.pack(label,align=pygame_menu.locals.ALIGN_CENTER)
frame1.pack(image,align=pygame_menu.locals.ALIGN_CENTER)
#Putting a button with this function into the frame2
frame2.pack(menu.add.button("Do issue", issue),align=pygame_menu.locals.ALIGN_CENTER)
#window loop
menu.mainloop(surface)
Expected behavior
The repacked widgets should not merge and should be centered; in this example nothing should move when pressing on "Do issue"
Environment information
Describe the bug When a widget is unpacked then repacked, it is misplaced and merges with other widgets in the frame.
To Reproduce Execute this code then press on the "Do issue" button
Expected behavior The repacked widgets should not merge and should be centered; in this example nothing should move when pressing on "Do issue"