python - How to reinitialize text widget in Tkinter? -


i trying return search result of user in gui itself. following code using

def printresult(searchresult): global resultsframe text = text(resultsframe)  in searchresult:     text.insert(end,i+'\n') text.pack(side=top)  

where searchresult list has statements printed on screen , how declared resultsframe in code (before root.mainloop()) using global makes changes existing frame rather adds frame below it. how make changes in existing text widget?

resultsframe = frame(root) resultsframe.pack(side=top) 

for reference here image of gui:

creation of new text widget

edit : issue solved

i declared frame outside function

resultsframe = frame(root) resultsframe.pack(side=top) text = text(resultsframe)  def printresult(searchresult):    global resultsframe    global text    text.delete("1.0",end)    in searchresult:        text.insert(end,str(i)+'\n')    text.pack(side=top)  

try this:

global resultsframe text = text(resultsframe)  def printresult(searchresult):     in searchresult:         text.insert(end,i+'\n') ... text.pack(side=top)  

this should solve issue.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

elasticsearch python client - work with many nodes - how to work with sniffer -

delphi - Disable and change color of node in Treeview -