Hi all,
Have my below program:
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
class Application(object):
def __init__(self, master):
self.master = master
qPlacement = IntVar()
self.cc = ttk.Combobox(self.master, textvariable=qPlacement, width = 5).place(x = 5, y = 30)
Button(self.master, text = 'Click Me', command = self.popCombo).place(x = 5, y = 60)
def popCombo(self):
print('Inside function')
val = []
min = 0
max = 10
while min <= max:
val.append(min)
min += 1
self.cc['values'] = val
def main():
root = Tk()
app = Application(root)
root.title("Test App")
root.geometry('200x200')
root.resizable(False, False)
root.mainloop()
if __name__ == '__main__':
main()
Such is my goal with this; when I click on the button it will call my function (popCombo) which will then loop through 0 - 10, add the items to my list and then populate the combobox values with the values from my list. I thought I saw that this was possible using self.cc['values'] = val.
But for some reason its throwing a type error exception. TypeError: 'NoneType' object does not support item assignment. Does this mean that this type of operation cannot be done. I double checked my list and I def have values in it.
Thanks :)