문제

I have a master canvas

canvas = Canvas(root,width=1200,height=800)

and a lot of child widgets such as lists and frames and canvases inside frames

I want to write a function that gives in just the parent canvas and access the child in a form like

def showInstrumentList(canvas):
    child_listbox = canvas.listbox <== this kind of approach (not real code)

I have a lot of child widgets spread across my program and i really need a way to access these child widgets from the top down. (So everything starting from the parent and finding its way down)

Is there anyway to do that?

도움이 되었습니까?

해결책

You can do

canvas = Canvas(root,width=1200,height=800)
canvas.label = Label(canvas)

You can add new attributes.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top