Question

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?

Was it helpful?

Solution

You can do

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

You can add new attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top