I’ve been trying to figure out how to make a simple bgui Frame to appear/disappear with a press of a button.
I have root Frame which has an Inventory frame in it. I just haven’t managed to make the frame to be visible/not visible.
I have managed to get so far so that it appears, but then it won’t disappear again.
Sample code under:
self.frame_inventory = bgui.Frame(self.root, 'frame_inventory', border=1,
pos=[screenXpx*16, screenYpx*80], size=[0.3, 0.3])
#Button's command function
def button_click(self, widget):
if bge.logic.globalDict['inventory_show'] == False:
bge.logic.globalDict['inventory_show'] = True
else:
bge.logic.globalDict['inventory_show'] = False
...and this is where it runs to a wall for me. I can't figure out how to remove the self.frame_inventory while running the game :).