我刚刚打包我的应用程序(OSX 10.12.15 - python3.6 - py2app 0.12),我的应用程序仅在从function exportToExcel()
{
var tab_text="<table border='1px'><tr bgcolor='#87AFC6'>";
var timeDate = getCurrentTimeDate();
var fileName = "registers"+timeDate+".xls";
tab = document.getElementById('dt_myTable');
for(j = 0 ; j < tab.rows.length ; j++)
{
tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
}
tab_text=tab_text+"</table>";
tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");
tab_text= tab_text.replace(/<img[^>]*>/gi,"");
tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, "");
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
{
txtArea1.document.open("txt/html","replace");
txtArea1.document.write(tab_text);
txtArea1.document.close();
txtArea1.focus();
sa=txtArea1.document.execCommand("SaveAs",true, fileName);
}
else
sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));
return (sa);
}
终端启动时才有效。如果我点击GUI中的应用程序,它就不会启动。
这是我的setup.py:
MyApp.app/Contents/MacOS/MyApp