Hello,
I want to create a loop that creates Buttons and Entries. I figured I'd loop through giving them iterative names; button1 entry1Min entry1Max button2 entry2Min entry2Max and so forth.
I've got it making the widgets:
But I think this is wrong. It doesn't seem to be recognizing that it's supposed to use the variables. Instead of me getting a button called (sceneName + "Button") I think I get a button called sceneNameButton, the variable's name.
So how does one make a loop that returns unique object names? I've tried variable substitution: self.%s=Button() % sceneName. But that just gives me a syntax error.
I hope this makes sense. Any help would be appreciated. Thanks in advance.
-James
I want to create a loop that creates Buttons and Entries. I figured I'd loop through giving them iterative names; button1 entry1Min entry1Max button2 entry2Min entry2Max and so forth.
I've got it making the widgets:
Code:
for i in range(1, int(numOfScenes) + 1):
sceneName = ("Sc_" + str(i).zfill(padding))
self.jpSSR_CreateScene(sceneName, i)
def jpSSR_CreateScene(self, sceneName, number):
sceneNameButton = (sceneName + "Button")
self.sceneNameButton = Button(self.buttonFrame, text=sceneName, command=self.collectData(sceneName))
self.sceneNameButton.grid(row=(number + 2), column=0, sticky=E+W)
But I think this is wrong. It doesn't seem to be recognizing that it's supposed to use the variables. Instead of me getting a button called (sceneName + "Button") I think I get a button called sceneNameButton, the variable's name.
So how does one make a loop that returns unique object names? I've tried variable substitution: self.%s=Button() % sceneName. But that just gives me a syntax error.
I hope this makes sense. Any help would be appreciated. Thanks in advance.
-James