Closed nickandwolf closed 1 year ago
Hi, do you have some example code or some picture with the actual/desired results? Maybe you should assign a layout in the window or the frame has zero size.
Please ignore my filler text.
https://replit.com/@NicholasNelson/NaturalBoldCopyrightinfringement#main.py
def main():
rootLayout = ttk.TTkGridLayout()
root = ttk.TTk(layout=rootLayout)
mainWin = ttk.TTkFrame(parent=root, pos=(0, 0), title="", border=True)
ttk.TTkLabel(parent=mainWin,
pos=(1, 1),
text="NCPD Punk B.U.S.T.R. - powered by WorldSat",
alignment=ttk.TTkK.CENTER_ALIGN)
def _close(btn):
pass
def _test(btn):
secondWin = ttk.TTkWindow(parent=mainWin,
pos=(4, 4),
size=(30, 10),
title="Shit",
border=True)
secondWin.menubarTop().addMenu(
"&X", alignment=ttk.TTkK.RIGHT_ALIGN).menuButtonClicked.connect(
lambda a: _close(secondWin))
secondWin.menubarTop().addMenu("TESTSETSET",
alignment=ttk.TTkK.LEFT_ALIGN)
secondFrame = ttk.TTkFrame(parent=secondWin, title="TESTING", border=True)
secondFrame.addWidget(ttk.TTkLabel(parent=secondFrame, pos=(2, 2), text="poop"))
secondWin.addWidget(ttk.TTkLabel(parent=secondFrame,pos=(10,10), text="oh wow"))
mainWin.menubarTop().addMenu("Campaign").menuButtonClicked.connect(_test)
mainWin.menubarTop().addMenu("Players")
mainWin.menubarTop().addMenu("Characters")
root.mainloop()
I would like to have a window appear. Inside that window is a Frame. Inside that Frame are widgets. Normally this would be done by setting the parent to the container but it doesn't appear to be that simple.
parent->child EX:
Root->Window->Frame->Button
I'm used to Tkinter but I'm banging my head against a wall trying to get nested layouts and containers working.
Alright, got back to my code, put a size and pos for the frame and it appears now. It was just crazy chaos trying to get things working without reverse engineering. Thank you for the prompt reply, sorry for the confusion.
I realised a bug with theclose event, you can workaround temporarely it updating the frame:
def _close(win):
win.close()
mainWin.update()
you can try it here
Hello! For the life of me, I cannot get frames to render in a window.