On 04/10/17 14:40, edmundo pierre via Tutor wrote: > Hello, > I am writing a code
When posting code please use plain text. HTML gets mangled so we can't see what your code looks like.(see below) > where I am using a empty list and I will fill up that > list with object. Then I will show those on my Tkinter> screen that I > create. But when I run my code ,it crashes. Any help? You haven't shown us any code that runs let alone freezes. Also apart from the 'a' and 'a1' var types there is no Tkinter involved. > # Variable a = Intvar() a1 = DoubleVar() > #Create a function > def Answe(): A = a.get() B = [ ] C = a1.get() while A > > 0: C = a1.get() B.append(C) A = A - 1 > When I run this function about my program freezes. It shouldn't do anything. You have only defined a couple of variables and a function, but nowhere do you have any code that does anything. You need to post all of the code if this is not it. > I do not know how to add element in a list using Tkinter. This has nothing to do with Tkinter. You are using a standard Python list: B = [] so you use standard Python to append elements, which you are already doing. B.append(C) But that list will not be displayed anywhere because you don't have any code to do so. You need to create a Tkinter window with a widget to display the list - it could be a Label, a Text widget or a Listbox, or any of several other options. For a Label called myLabel you would just assign the str() representation of your list to the text property: myLabel['text'] = str(B) It all depends on how you want it to appear. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor