I've got this list:
runner.sublist = [["one","two","three"],["red","black","blue]]
and this class definition
class popupWindow(object): def __init__(self, master, txt): top = self.top = Toplevel(master) self.l = Label(top, text=txt) self.l.pack() self.b = Button(top, text='Fine....', command=self.cleanup) self.b.pack() def popup(self,txt): self.w=popupWindow(self.master, txt) self.master.wait_window(self.w.top)
And I'm trying to get this button to make a popup window that has the
runner.sublist list printed in the popup with newlines after every group of elements (one two three on the first line, red black blue on the second, etc.)
def print_it(op): out = '\n'.join(op) return out class mainWindow(object): def __init__(self,master): self.master=master self.b2=Button(master,text="print value",command=lambda: self.popup(print_it(runner.sublist))) self.b2.pack()
However, this code returns the following error:
TypeError: sequence item 0: expected string, list found
Clearly, I'm passing a list where I should have a string, but I'm totally stumped as to why it's getting a list! I've tried to coerce some of the values into strings at various places, but that had no luck.
Any ideas? Thanks!