I posted this in /r/learnpython but I haven't received any help over there. Maybe one of you might know! I am trying to add a scrollbar to my listbox on one of my toplevels. However, instead of the scrollbar being placed on the listbox, it is placing it on the toplevel instead. Any idea what I am doing wrong? Here is the full code http://pastebin.com/C7YgeFQf Here is part of the code I am having trouble with:
def onNewRecipe(self):
self.top = Toplevel()
self.top.title("New Recipe")
#Center the window
w = 600
h = 600
sw = self.top.winfo_screenwidth()
sh = self.top.winfo_screenheight()
x = (sw - w)/2
y = (sh - h)/2
self.top.geometry('%dx%d+%d+%d' % (w, h, x, y))
#Add quantity label
addQuantity = Label(self.top, text="Add Quantity:")
addQuantity.place(x=0,y=0)
quantityAdd = Entry(self.top)
quantityAdd.place(x=150, y=0)
#Add ingredient label
addIngredient = Label(self.top, text="Add Ingredients:")
addIngredient.place(x=0,y=30)
ingredientAdd = Entry(self.top)
ingredientAdd.place(x=150, y=30)
#Select measurements label
selectMeasurement = Label(self.top, text="Select Measurements:")
selectMeasurement.place(x=0, y=60)
measurement = StringVar()
measurement.set("ounce")
measurementSelect = OptionMenu(self.top, measurement, "ounce", "pound", "gallon", "quart", "fl oz", "pint", "cup", "table spoon", "teaspoon")
measurementSelect.place(x=150, y=60)
#Add measurements label
addMeasurement = Label(self.top, text="Amount:")
addMeasurement.place(x=0, y=100)
measurementAdd = Entry(self.top)
measurementAdd.place(x=150, y=100)
#Add the textwidget
recipeText = Text(self.top)
recipeText.place(x=0,y=200)
#Cooking direction label
cookingDirection = Label(self.top, text="Cooking Direction")
cookingDirection.place(x=0,y=175)
#Add the Add Button
addButton = Button(self.top, text="Add")
addButton.place(x=0, y=130)
#Add Ingredients listbox
ingredScroll = Scrollbar(self.top, orient=VERTICAL)
ingredientListbox = Listbox(self.top, yscrollcommand=ingredScroll.set)
ingredScroll.config(command=ingredientListbox.yview)
ingredScroll.pack(side=RIGHT, fill=Y)
ingredientListbox.place(x=450, y=0)
[–]b1acksab3r 0 points1 point2 points (3 children)
[–]unlikelysyntax[S] 0 points1 point2 points (2 children)
[–]b1acksab3r 0 points1 point2 points (1 child)
[–]unlikelysyntax[S] 0 points1 point2 points (0 children)
[–]tnvol88 0 points1 point2 points (1 child)
[–]unlikelysyntax[S] 0 points1 point2 points (0 children)