Not Responding When Dealing with Large Data
cutey Love
cuteywithlove at gmail.com
Thu Jun 19 04:17:46 EDT 2014
update_idletasks didn't work.
The code is this
file_path = filedialog.askopenfilename(filetypes=[('text files', '.txt')], multiple=True, defaultextension=".txt")
for path in file_path:
fo = open(path, "r")
for line in fo:
if myCase(line.lower()):
myList.append(line.lower())
fo.close()
def myCase(c):
if c in myList:
return False
if len(c) < 8 or len(c) > 80:
return False
return True
This processes a fair bit of data
On Thursday, June 19, 2014 12:06:26 AM UTC+1, Ian wrote:
> On Wed, Jun 18, 2014 at 4:32 PM, cutey Love <cuteywithlove at gmail.com> wrote:
>
> > Hi, thanks for the replies,
>
> >
>
> > I mean windows displays "Not responding close the program now"
>
> >
>
> > How can I do it asynconistrically?
>
> >
>
> > It's simple code just open file, loop through line by line and do some comparons with the string.
>
>
>
> If all you want is to prevent Windows from displaying that message
>
> then I believe all you need to do is periodically call
>
> frame.update_idletasks() (or the equivalent if you're using some
>
> framework other than tkinter) so that the basic window events will get
>
> processed.
More information about the Python-list
mailing list