for (iheaderin enumerate(showhdrs)lab label(middletext=header+':'justify=leftent entry(middlelab grid(row=icolumn= sticky=ewent grid(row=icolumn= sticky=ewmiddle rowconfigure(iweight= hdrvalue headermap get(header'?'might be empty if encodeddecode per email+mime+unicode if header not in addrhdrshdrvalue self decodeheader(hdrvalueelsehdrvalue self decodeaddrheader(hdrvalueent insert(' 'hdrvalueself hdrfields append(entorder matters in onsend middle columnconfigure( weight= return left def actionbuttons(self)return [('cancel'self destroy)('parts'self onparts)('split'self onsplit)must be method for self close view window silently multiparts list or the body def makepartbuttons(self)""add up to buttons that open attachments/parts when clickedalternative to parts/split ( )okay that temp dir is shared by all open messagespart file not saved till later selected and openedpartname=partname is required in lambda in py caveatwe could try to skip the main text part""def makebutton(parenttextcallback)link button(parenttext=textcommand=callbackrelief=sunkenif mailconfig partfglink config(fg=mailconfig partfgif mailconfig partbglink config(bg=mailconfig partbglink pack(side=leftfill=xexpand=yesparts frame(selfparts pack(side=topexpand=nofill=xfor (countpartnamein enumerate(self partslist(self origmessage))if count =self maxpartbuttonsmakebutton(parts'self onsplitbreak openpart (lambda partname=partnameself ononepart(partname)makebutton(partspartnameopenpartdef ononepart(selfpartname)""locate selected part for button and save and openokay if multiple mails openresaves each time selectedwe could probably just use web browser directly herecaveattemppartdir is relative to cwd poss anywherecaveattemppartdir is never cleaned upmight be large the pymailgui client