Pyinstaller给出致命错误(返回-1)

时间:2016-03-20 11:58:03

标签: python tkinter fatal-error tk pyinstaller

a[s]

我正在尝试使用pyinstaller为我的tk.tkinter python GUI程序制作.exe文件,但它给了我Fatal error返回-1。它有什么问题可以帮助我 我在命令提示符下键入了这个:

try:
    import Tkinter as tk
    import ttk
except ImportError:
    import tkinter as tk
    from tkinter import ttk
    import math

TITLE_FONT = ("Helvetica", 18, "bold")

class SampleApp(tk.Tk):

    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)

        # the container is where we'll stack a bunch of frames
        # on top of each other, then the one we want visible
        # will be raised above the others
        container = tk.Frame(self)
        container.pack(side="top", fill="both", expand=True)
        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        self.frames = {}
        for F in (PageTwo, PageOne, StartPage,PageThree,PageFour):
            page_name = F.__name__
            frame = F(container, self)
            self.frames[page_name] = frame

            # put all of the pages in the same location;
            # the one on the top of the stacking order
            # will be the one that is visible.
            frame.grid(row=0, column=0, sticky="nsew")

        self.show_frame("PageTwo")

    def show_frame(self, page_name):
        '''Show a frame for the given page name'''
        frame = self.frames[page_name]
        frame.tkraise()


class StartPage(tk.Frame):

    def __init__(self, parent, controller):

        def cal():
            xx= float(w31.get())
            xy=float(w32.get())
            xz=float(w33.get())
            yx=float(w34.get())
            yy=float(w35.get())
            yz=float(w36.get())
            zx=float(w37.get())
            zy=float(w38.get())
            zz=float(w39.get())
            cxx=math.cos(xx)
            cxy=math.cos(xy)
            cxz=math.cos(xz)
            cyx=math.cos(yx)
            cyy=math.cos(yy)
            cyz=math.cos(yz)
            czx=math.cos(zx)
            czy=math.cos(zy)
            czz=math.cos(zz)
            uxx= float(w11.get())
            uyy=float(w12.get())
            uzz=float(w13.get())
            txy=float(w14.get())
            tyz=float(w15.get())
            txz=float(w16.get())

            A= (uxx*cxx*cxx)+(uyy*cxy*cxy)+(uzz*cxz*cxz)+(2*txy*cxx*cxy)+(2*tyz*cxy*cxz)+(2*txz*cxx*cxz) 
            A= round(A,3)
            B= (uxx*cyx*cyx)+(uyy*cyy*cyy)+(uzz*cyz*cyz)+(2*txy*cyy*cyx)+(2*tyz*cyy*cyz)+(2*txz*cyx*cyz)
            B= round(B,3)

            C= (uxx*czx*czx)+(uyy*czy*czy)+(uzz*czz*czz)+(2*txy*czx*czy)+(2*tyz*czy*czz)+(2*txz*czx*czz)
            C= round(C,3)

            Dxy= (uxx*cxx*cyx)+(uyy*cxy*cyy)+(uzz*cxz*cyz)+(txy*((cxx*cyy)+(cxy*cyx)))+(tyz*((cxy*cyz)+(cyy*cxz)))+(txz*((cxz*cyx)+(cxx*cyz))) 
            Dxy= round(Dxy,3)
            Dyz= (uxx*czx*cyx)+(uyy*czy*cyy)+(uzz*czz*cyz)+(txy*((cyx*czy)+(cyy*czx)))+(tyz*((cyy*czz)+(cyz*czy)))+(txz*((czz*cyx)+(czx*cyz)))
            Dyz= round(Dyz,3)
            Dxz= (uxx*cxx*czx)+(uyy*cxy*czy)+(uzz*cxz*czz)+(txy*((cxx*czy)+(cxy*czx)))+(tyz*((cxy*czz)+(czy*cxz)))+(txz*((cxz*czx)+(cxx*czz)))
            Dxz= round(Dxz,3)
            b18.delete(0,tk.END)
            b18.insert(0,A)
            b19.delete(0,tk.END)
            b19.insert(0,B)
            b20.delete(0,tk.END)
            b20.insert(0,C)
            b21.delete(0,tk.END)
            b21.insert(0,Dxy)
            b22.delete(0,tk.END)
            b22.insert(0,Dyz)
            b23.delete(0,tk.END)
            b23.insert(0,Dxz)



        def re1():
            w11.set(0)
            w12.set(0)
            w13.set(0)
            w14.set(0)
            w15.set(0)
            w16.set(0)
        def re():
            w31.set(0)
            w32.set(0)
            w33.set(0)
            w34.set(0)
            w35.set(0)
            w36.set(0)
            w37.set(0)
            w38.set(0)
            w39.set(0)
        def quiit():
            app.destroy()
        tk.Frame.__init__(self, parent)
        self.controller = controller
        frame =tk.Frame(self)
        frame.grid(row=0,column=0, sticky="n")
        frame1=tk.Frame(frame)
        frame1.grid(row=0,column=0, sticky="n")
        photo=tk.PhotoImage(file="im205.gif")
        a1= ttk.Label(frame1,image=photo)
        a1.photo=photo
        a1.grid(row=0,column=0)
        frame2=tk.Frame(frame)
        frame2.grid(row=1,column=0,  sticky="ew")
        frame3=tk.Frame(frame2)
        frame3.grid(row=1,column=0,  sticky="n")
        ttk.Separator(frame2,orient="horizontal").grid(row=0,column=0,sticky="ew")
        ttk.Separator(frame2,orient="horizontal").grid(row=0,column=2,sticky="ew")
        c1= ttk.Button(frame3,text="Home", command=lambda: controller.show_frame("PageTwo"),width='19' )
        c1.grid(row=4,column=0)
        c1= ttk.Button(frame3,text="Point Stress" ,command=lambda: controller.show_frame("PageOne"),width='19' )
        c1.grid(row=5,column=0)
        c1= ttk.Button(frame3,text="Stress Transformation",command=lambda: controller.show_frame("StartPage"),width='19' )
        c1.grid(row=6,column=0)
        c1= ttk.Button(frame3,text="Principle Stresses",command=lambda: controller.show_frame("PageThree"),width='19' )
        c1.grid(row=7,column=0)
        c1= ttk.Button(frame3,text="3DMohr Circle",command=lambda: controller.show_frame("PageFour"),width='19' )
        c1.grid(row=8,column=0)

        c1= ttk.Button(frame3,text="Quit",command=quiit,width='19')
        c1.grid(row=9,column=0)
        ttk.Separator(frame2,orient=tk.VERTICAL).grid(row=1,column=1,sticky="sn")
        ttk.Separator(frame2,orient="horizontal").grid(row=2,column=0,sticky="ew")
        ttk.Separator(frame2,orient="horizontal").grid(row=2,column=2,sticky="ew")
        d= ttk.Label(frame,text="Stress Analysis (X1.0)℠© by Daniyal Wasim ")
        d.grid(row=3,column=0)

        frame4=tk.Frame(frame2)
        frame4.grid(row=1,column=2,  sticky="n")
        l=ttk.Labelframe(frame4,width=700,height=600,borderwidth='5',text='Stress Transformation')
        l.grid(row=1,column=1)
        frame4a=tk.Frame(l)
        frame4a.grid(row=1,column=1,  sticky="n")
        l1=ttk.Labelframe(frame4a,width=200,height=200,borderwidth='5',text='Cordinates')
        l1.grid(row=2,column=1)
        l2=ttk.Labelframe(frame4a,width=200,height=200,borderwidth='5',text='Reference Points')
        l2.grid(row=2,column=2)
        l3=ttk.Labelframe(l,width=200,height=200,borderwidth='5',text='Transformation Points')
        l3.grid(row=2,column=1)

        op= ttk.Label(l2,text="σxx(MPa)")
        op.grid(row=0,column=0)
        w11=tk.StringVar()
        b11= ttk.Entry(l2,text=w11,width='7')
        b11.grid(row=0,column=1)
        op1= ttk.Label(l2,text="σyy(MPa)")
        op1.grid(row=1,column=0)
        w12=tk.StringVar()
        b12= ttk.Entry(l2,text=w12,width='7')
        b12.grid(row=1,column=1)
        op2= ttk.Label(l2,text="σzz(MPa)")
        op2.grid(row=2,column=0)
        w13=tk.StringVar()
        b13= ttk.Entry(l2,text=w13,width='7')
        b13.grid(row=2,column=1)
        op4= ttk.Label(l2,text="Txy(MPa)")
        op4.grid(row=0,column=2)
        w14=tk.StringVar()
        b14= ttk.Entry(l2,text=w14,width='7')
        b14.grid(row=0,column=3)
        op5= ttk.Label(l2,text="Tyz(MPa)")
        op5.grid(row=1,column=2)
        w15=tk.StringVar()
        b15= ttk.Entry(l2,text=w15,width='7')
        b15.grid(row=1,column=3)
        op6= ttk.Label(l2,text="Txz(MPa)")
        op6.grid(row=2,column=2)
        w16=tk.StringVar()
        b16= ttk.Entry(l2,text=w16,width='7')
        b16.grid(row=2,column=3)
        c17= ttk.Button(l2,text="Reset",command=re1)
        c17.grid(row=6,column=0)

        op= ttk.Label(l3,text="σx'x'(MPa)")
        op.grid(row=0,column=0)
        w18=tk.StringVar()
        b18= ttk.Entry(l3,text=w18,width='7')
        b18.grid(row=0,column=1)
        op1= ttk.Label(l3,text="σy'y'(MPa)")
        op1.grid(row=1,column=0)
        w19=tk.StringVar()
        b19= ttk.Entry(l3,text=w19,width='7')
        b19.grid(row=1,column=1)
        op2= ttk.Label(l3,text="σz'z'(MPa)")
        op2.grid(row=2,column=0)
        w20=tk.StringVar()
        b20= ttk.Entry(l3,text=w20,width='7')
        b20.grid(row=2,column=1)
        op4= ttk.Label(l3,text="Tx'y'(MPa)")
        op4.grid(row=0,column=2)
        w21=tk.StringVar()
        b21= ttk.Entry(l3,text=w21,width='7')
        b21.grid(row=0,column=3)
        op5= ttk.Label(l3,text="Ty'z'(MPa)")
        op5.grid(row=1,column=2)
        w22=tk.StringVar()
        b22= ttk.Entry(l3,text=w22,width='7')
        b22.grid(row=1,column=3)
        op6= ttk.Label(l3,text="Tx'z'(MPa)")
        op6.grid(row=2,column=2)
        w23=tk.StringVar()
        b23= ttk.Entry(l3,text=w23,width='7')
        b23.grid(row=2,column=3)
        c17= ttk.Button(l3,text="Calculate", command=cal)
        c17.grid(row=3,column=0)

        op= ttk.Label(l1,text="x")
        op.grid(row=0,column=1)
        w31=tk.StringVar()
        b31= ttk.Entry(l1,text=w31,width='7')
        b31.grid(row=1,column=1)
        op1= ttk.Label(l1,text="y")
        op1.grid(row=0,column=2)
        w32=tk.StringVar()
        b32= ttk.Entry(l1,text=w32,width='7')
        b32.grid(row=2,column=1)
        op2= ttk.Label(l1,text="z")
        op2.grid(row=0,column=3)
        w33=tk.StringVar()
        b33= ttk.Entry(l1,text=w33,width='7')
        b33.grid(row=3,column=1)
        op4= ttk.Label(l1,text="x'")
        op4.grid(row=1,column=0)
        w34=tk.StringVar()
        b34= ttk.Entry(l1,text=w34,width='7')
        b34.grid(row=1,column=2)
        op5= ttk.Label(l1,text="y'")
        op5.grid(row=2,column=0)
        w35=tk.StringVar()
        b35= ttk.Entry(l1,text=w35,width='7')
        b35.grid(row=2,column=2)
        op6= ttk.Label(l1,text="z'")
        op6.grid(row=3,column=0)
        w36=tk.StringVar()
        b36= ttk.Entry(l1,text=w36,width='7')
        b36.grid(row=3,column=2)
        w37=tk.StringVar()
        b37= ttk.Entry(l1,text=w37,width='7')
        b37.grid(row=1,column=3)
        w38=tk.StringVar()
        b38= ttk.Entry(l1,text=w38,width='7')
        b38.grid(row=2,column=3)
        w39=tk.StringVar()
        b39= ttk.Entry(l1,text=w39,width='7')
        b39.grid(row=3,column=3)
        c20= ttk.Button(l1,text="Reset",command=re)
        c20.grid(row=6,column=0)













if __name__ == "__main__":
    app = SampleApp()
    app.geometry('610x470-350+250')
    app.resizable(width='FALSE', height='FALSE')
    app.title("Stress Analysis X1.0")
    app.iconbitmap('bicon.ico')
    app.mainloop()

0 个答案:

没有答案