near the bottom of the code you see print statements there. The code executes fine however if they are removed the application locks until the operations finishes. It dos not destroy or add the appropriate widgets until it is completely done. Effectively defeating the purpose of changing them in the first place.

def close():
                zipName = wig[1].get()
                toLine = wig[0].get()

                message = "Attached is the pictures for "+zipName+". \n\n\
                \n This is an Automated Message \
                \n Created by BIEC \n © Travis W. Kneale "\

                email1 = tk.Label(sendEmail, font=('arial','20','bold'), text=zipName+"is being resized....")
                email2 = tk.Label(sendEmail, font=('arial','20','bold'), text=zipName+"is being sent.......")
                emailLabel.destroy()
                wig[0].destroy()
                emailName.destroy()
                wig[1].destroy()
                button1.destroy()
                
                email1.pack()
                print '1'
                picConvert(working_list[0],  working_list[1], zipName)
                email2.pack()
                print '2'
                sendMail(zipName+" Pictures", message, toLine, picSetup[0]+"/"+zipName+".zip")
                del working_list[0:]
                sendEmail.destroy()
  
                
                return

Thanks for taking the time to look at my Code

the locking issues all occur when once this code is compiled via py2exe

That must have been a crappy post

Application is here:
http://www.box.net/shared/lyhoflko6z

also

def sendMail(subject, text, recipient, attachmentFile):

  
  assert type(attachmentFile)==list
  
  smtpcc   = str(eMailSetup[0])
  smtpUser = str(eMailSetup[1])
  smtpPass = str(eMailSetup[2])
  smtpServer = str(eMailSetup[3])
  smtpPort = int(eMailSetup[5])
  
  msg = MIMEMultipart()
  msg['From'] = smtpUser
  msg['To'] = recipient
  msg['Date'] = formatdate(localtime=True)
  
  ##If user wants a copy of the email he/she will get one 
  if picSetup[1].upper() =="YES":
    msg['Cc'] = smtpcc
    recipientcom = [str(recipient), str(smtpcc)]
  else:
      recipientcom = [recipient]

  msg['Subject'] = subject
  msg.attach(MIMEText(text))

  for f in attachmentFile:
    part = MIMEBase('application', "octet-stream")
    part.set_payload( open(f,"rb").read() )
    Encoders.encode_base64(part)
    part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
    msg.attach(part)


  mailServer = smtplib.SMTP(smtpServer, smtpPort)

  if eMailSetup[4].upper() =="YES":
    mailServer.ehlo()
    mailServer.starttls()
    mailServer.ehlo()
    mailServer.login(smtpUser, smtpPass)
  
  mailServer.sendmail(smtpcc, recipientcom, msg.as_string())
  mailServer.close()
def picConvert(start, end, zipName):
    
    zip = zipfile.ZipFile(picSetup[0]+'/'+zipName+".zip", 'w')
    for picId, pathname in enumerate(pic_list):
        if start <= picId and picId <= end:
            img = Image.open(filedir+'/'+pathname)
            width,height = picSetup[4],picSetup[5]
            if img.size[0] < img.size[1]:
                width,height = height,width


            resized_img = img.resize((int(width), int(height)), Image.ANTIALIAS) # best down-sizing filter
            resized_img.save(picSetup[0]+'/image.jpg')
            zip.write(picSetup[0]+'/image.jpg', arcname=pathname)
    zip.close()

Thanks

Edited 7 Years Ago by kingofkya: n/a

This article has been dead for over six months. Start a new discussion instead.