コード例 #1
0
ファイル: entry_frame.py プロジェクト: ubnt-marty/testlib
class InfoFrame(Frame):
    def __init__(self, parent, question):
        Frame.__init__(self, parent)
        self.answer = StringVar()
        self.question = Label(self, text=question, style='Title.TLabel')
        self.question.grid(column=0, row=0, padx=10, pady=10, sticky='w')
        self.configure(background='yellow')
        self.question.configure(background='yellow')

        self.bar = Separator(self, orient=HORIZONTAL)
        self.bar.grid(column=0,
                      row=2,
                      columnspan=2,
                      padx=5,
                      pady=5,
                      sticky='nsew')

        self.ok = Button(self, text='OK', command=self.OkBut)
        self.ok.grid(column=0, row=3, padx=5, pady=5)

        self.grid()

        # Center the Window
        parent.update_idletasks()
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(),
                                                 self.winfo_height(), xp, yp))

        self.update()
        parent.mainloop()

    def OkBut(self):
        self.quit()
コード例 #2
0
ファイル: main.py プロジェクト: Jual6332/HarnessGUI
def display_ClassConfigs(name,self,controller):
	i=1;j=2; # Column and row incrementers
	sty = Style(self); sty.configure("TSeparator", background="black");
	if name == "DetailsPage":
		inputdata = load_configdata(); set_configunits(); # Load data, store units
		for key in Application.key_order:
			if i>7:	i = 1; j = j+1; # Column limit exceeded, begin new row
			labelName = tk.Label(self,font = NORMAL_FONT,text=key + ":"); labelName.grid(column=i, row=j);
			fieldName = tk.Entry(self); fieldName.grid(column=i+2, row=j, rowspan=1);
			fieldName.insert(1,inputdata[key]);	fieldName.configure(state="readonly");
			if Application.units_set[key] != "None":
				unitsLabel = tk.Label(self,font = NORMAL_FONT,text="("+Application.units_set[key]+")"); unitsLabel.grid(column=i+4, row=j);
			sep = Separator(self, orient="vertical")
			sep.grid(column=6, row=j-1, rowspan=2, sticky="nsew")
			Application.DetailsPage_entries.append(fieldName); Application.DetailsPage_labels.append(labelName); # Store widgets 
			i = i+6 # Column for Second label/entry pair
		backbutton = tk.Button(self, bd = "2", fg = "white", bg = "blue", font = NORMAL_FONT, text="Back",command=lambda: controller.show_frame(SettingsPage)).grid(row=int(math.ceil(len(Application.key_order)/2))+2,column=13,rowspan=1)
		editbutton = tk.Button(self, bd = "2", fg = "white", bg = "gray", font = NORMAL_FONT, text="Edit",command=lambda: controller.show_frame(EditConfigsPage)).grid(row=int(math.ceil(len(Application.key_order)/2))+2,column=12,rowspan=1)
	else:
		for key in Application.key_order:
			if i>7: i = 1; j = j+1; # Column limit exceeded, begin new row
			labelName = tk.Label(self,font = NORMAL_FONT,text=key + ":"); labelName.grid(column=i, row=j);
			fieldName = tk.Entry(self); fieldName.grid(column=i+2, row=j);
			fieldName.insert(5,Application.configData[key]); # Create entry, add data
			if Application.units_set[key] != "None":
				unitsLabel = tk.Label(self,font = NORMAL_FONT,text="("+Application.units_set[key]+")"); unitsLabel.grid(column=i+4, row=j);
			sep = Separator(self, orient="vertical")
			sep.grid(column=6, row=j-1, rowspan=2, sticky="nsew")
			Application.EditPage_entries.append(fieldName); Application.EditPage_labels.append(labelName); # Store widgets
			i = i+6 # Column for Second label/entry pair
		Application.firstEdit = False # Config settings have been edited
	pad_children(self) # Assign padding to child widgets
コード例 #3
0
ファイル: FrameFieller.py プロジェクト: remislp/DC-Stats
    def createFrame(self, root):
        """Creates main frame and data input field."""
        frame = Frame(root)
        frame.pack()
        frame.config(background="#dcdcdc") #well, it has to be, right?
        message = Message(frame, width = 350, text="\n"+Fieller.introd, justify=LEFT, font=("Helvetica", "11"), background="#dcdcdc")
        message.grid(row=0, column=0, rowspan=10, columnspan=4)

        s = Separator(frame, orient=HORIZONTAL)
        s.grid (columnspan=4, sticky=EW)
        # label list for the editable entryboxes
        # entry rows 0-6
        self.ll = ("Nominator (a)", "SD of Nom. (a)", "Denominator (b)", 
            "SD of Denom. (b)", "Correlation coefficient (a, b)", "Alpha", 
            "Total number of observations (Na + Nb)")
        self.sample_value = (14, 3, 7, 2, 0, 0.05, 12)

        self.entries = []
        self.sva = []
        #build labels and entry boxes
        for p in self.ll:
            i = len(self.sva)           #i.e. 0 when empty, 1 on next loop
            self.sva.append(StringVar())
            self.sva[i].trace("w", lambda name, index, mode, var=self.sva[i], 
                i=i: self.entryupdate(var, i))
            Label(frame, text=p, bg="#dcdcdc").grid(column=0, row=i+12, sticky=E)
            e = Entry(frame, width=8, textvariable=self.sva[i], 
                highlightbackground="#dcdcdc")
            e.grid(column=1, row=i+12)
            self.entries.append(e)
            self.entries[i].insert(END,str(self.sample_value[i]))        
        lframe = LabelFrame(root, text="Calculated", background="#dcdcdc", 
            padx=20, pady=2)

#        self.noneditable = ("Degrees of freedom (Na + Nb - 2)", "Two-tailed t value")
        # entry rows 7 & 8
#        for p in self.noneditable:
#            i = len(self.sva)
#            self.sva.append(StringVar())
#            #print self.sva
#            self.sva[i].trace("w", lambda name, index, mode, var=self.sva[i], i=i: self.entryupdate(var, i))
#            Label(lframe, text=p, bg="#dcdcdc").grid(column=0, row=i, padx=5, pady=3, sticky=E)
#            e = Label(lframe, width=8, textvariable=self.sva[i], anchor="w", highlightbackground="black", relief=SUNKEN)
#            e.grid(column=1, row=i, padx=5, pady=3)
#        self.ll = self.ll + self.noneditable
#        self.dfupdate()
#        self.tupdate()

        lframe.pack(padx=10, pady=2)
        tframe = Frame(root, background="#dcdcdc")
        tframe.pack()
        b1 = Button(tframe, text="Calculate", command=self.calback, highlightbackground="#dcdcdc").grid(row=1, columnspan=4)
        Label(tframe, text="", background="#dcdcdc").grid(row=2, column=0, columnspan=4)
        txt = Text(tframe)
        txt.grid(row=3, column=0, columnspan=4, padx=20)
        txt.config(width=60, height=9, font=("Courier", "11"))
        txt.insert(END, "Results will appear here")
        print ("fieller frame GUI created")
        self.txt = txt
コード例 #4
0
ファイル: status_frame.py プロジェクト: ubnt-marty/testlib
class StatusFrame(Frame):
    def __init__(self, parent, passfail, failtext):
        Frame.__init__(self, parent)
        self.status = StringVar()
        self.status_text = StringVar()

        self.statuslbl = Label(self, textvariable=self.status, style='Title.TLabel'); self.statuslbl.grid(column=0, row=1, columnspan=2, padx=100, pady=10)

        self.bar = Separator(self, orient=HORIZONTAL); self.bar.grid(column=0, row=2, columnspan=2, padx=5, pady=5, sticky='nsew')

        self.ok = Button(self, text='OK',  command=self.OkBut, width=10); self.ok.grid(column=0, columnspan=2, row=4, padx=5, pady=5)

        if passfail == 'PASS':
            self.TestPassed()
        elif passfail == 'FAIL':
            self.TestFailed(failtext)
        else:
            self.status.set('What?????')
            
        self.grid()

        # Center the Window
        parent.update_idletasks()
        
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(), self.winfo_height(), xp, yp))

        parent.mainloop()

    def OkBut(self):
        self.quit()

    def StatusText(self, text ):
        self.status_text.set(text)
        

    def TestInProgress(self):
        self.status.set('Test In Progress')
        self.statuslbl.configure(foreground='black')
        
    def TestPassed(self):         
        self.status.set('Test PASSED')
        self.configure(background='green')
        self.statuslbl.configure(background='green',foreground='yellow')
        
    def TestFailed(self, text):         
        self.status.set('Test FAIL')
        self.configure(background='red')
        self.statuslbl.configure(background='red',foreground='yellow')
        self.text = Text( self, relief=SUNKEN, width=110, height=16); self.text.grid(column=0, row=3, columnspan=2, sticky='nsew', padx=10, pady=10)
        self.text.insert(INSERT,text)
コード例 #5
0
ファイル: entry_frame.py プロジェクト: ubnt-marty/testlib
class EntryFrame(Frame):
    def __init__(self, parent, question, default_text):
        Frame.__init__(self, parent)
        self.answer = StringVar()
        self.answer.set(default_text)

        self.question = Label(self, text=question, style='Title.TLabel')
        self.question.grid(column=0, row=0, padx=10, pady=10, sticky='w')
        self.entry = Entry(self, width=25, textvariable=self.answer)
        self.entry.grid(column=0, row=1, padx=10)
        self.entry.select_range(0, END)
        self.entry.icursor(END)
        self.entry.bind('<Return>', func=lambda e: self.quit())
        self.entry.focus_force()

        self.bar = Separator(self, orient=HORIZONTAL)
        self.bar.grid(column=0,
                      row=2,
                      columnspan=2,
                      padx=5,
                      pady=5,
                      sticky='nsew')

        self.ok = Button(self, text='OK', command=self.OkBut)
        self.ok.grid(column=0, row=3, padx=5, pady=5, sticky='e')

        self.grid()

        # Center the Window
        parent.update_idletasks()
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(),
                                                 self.winfo_height(), xp, yp))

        self.update()
        parent.mainloop()

    def OkBut(self):
        self.quit()
コード例 #6
0
    def createFrame(self, root):
        'Creates main frame and data input field.'
        self.frame = Frame(root)
        self.frame.pack()
        self.frame.config(background="#dcdcdc")  #well, it has to be, right?

        #self.frame.geometry('600x800')
        message = Message(self.frame,
                          text="\n" + rantest.RTINTROD,
                          justify=LEFT,
                          padx=10,
                          width=500,
                          font=("Helvetica", 12),
                          bg="#dcdcdc")
        message.grid(row=0, column=0, rowspan=6, columnspan=2, sticky=W)

        s = Separator(self.frame, orient=HORIZONTAL)
        s.grid(columnspan=2, sticky=EW)

        Label(self.frame,
              text="Please select the data source:",
              justify=LEFT,
              bg="#dcdcdc").grid(row=15, column=0, padx=10, sticky=W)
        Label(
            self.frame,
            text=
            "The calculation will proceed automatically with\n the default number of randomisations (5000).\n\nUse [Repeat Calculation] for more repetitions\n(e.g. to estimate P < 0.001)",
            font=("Helvetica", 12),
            justify=LEFT,
            bg="#dcdcdc").grid(row=15, column=1, rowspan=4, sticky=S)
        self.b1 = Button(self.frame,
                         text="Input data manually",
                         command=self.callback1,
                         highlightbackground="#dcdcdc").grid(row=18,
                                                             column=0,
                                                             sticky=W,
                                                             padx=30)
        self.b2 = Button(self.frame,
                         text="Generic .txt file",
                         command=self.callback2,
                         highlightbackground="#dcdcdc").grid(row=17,
                                                             column=0,
                                                             sticky=W,
                                                             padx=30)
        self.b3 = Button(self.frame,
                         text="Excel Tab-delimited.txt file",
                         command=self.callback3,
                         highlightbackground="#dcdcdc").grid(row=16,
                                                             column=0,
                                                             sticky=W,
                                                             padx=30)

        Label(self.frame, text="Number of randomisations:",
              bg="#dcdcdc").grid(row=22, column=0, padx=30, pady=5, sticky=W)
        #default number of randomizations is 5000
        self.e5 = Entry(self.frame,
                        justify=CENTER,
                        width=12,
                        highlightbackground="#dcdcdc")
        self.e5.grid(row=22, column=1, sticky=W, pady=5)
        self.e5.insert(END, '5000')

        #checkbox for doing a paired test
        self.var1 = IntVar()
        text1 = "Paired test?"
        self.paired = False
        # Callback is not triggered if checkbox is never touched
        # Hence self.paired is set to zero above.
        c1 = Checkbutton(self.frame,
                         text=text1,
                         variable=self.var1,
                         command=self.callback_paired,
                         bg="#dcdcdc").grid(row=23,
                                            column=0,
                                            padx=30,
                                            pady=5,
                                            sticky=W)

        #checkbox to do bootstrap confidence intervals for Hedges' d
        ###Not implemented yet so check button is disabled
        ###Simple CI are calculated until bootstrap is implemented
        self.var2 = IntVar()
        hedges = "Calculate exact confidence intervals for Hedge's d?"
        self.H_CI = 0
        # Callback will not be triggered if checkbox is never touched
        # Hence self.H_CI is set to zero above.
        c2 = Checkbutton(self.frame,
                         text=hedges,
                         state=DISABLED,
                         variable=self.var2,
                         command=self.callback_hedges,
                         bg="#dcdcdc").grid(row=23,
                                            column=1,
                                            padx=30,
                                            pady=5,
                                            sticky=W)

        self.txt = Text(self.frame)
        self.txt.grid(row=25, column=0, columnspan=4, padx=10)
        self.txt.config(width=75, height=25, font=("Courier", "12"))
        self.txt.insert(END, "Results will appear here")

        #both these buttons are ungreyed after results are displayed.
        #Label(self.frame, text="").grid(row=(26), column=0, columnspan=4)
        self.b4 = Button(self.frame,
                         text="Repeat calculation",
                         state=DISABLED,
                         command=self.callback4,
                         highlightbackground="#dcdcdc")
        self.b4.grid(row=27, padx=40, pady=10, column=0, sticky=E)
        self.b5 = Button(self.frame,
                         text="Plot Distribution",
                         state=DISABLED,
                         command=self.callback5,
                         highlightbackground="#dcdcdc")
        self.b5.grid(row=27, padx=40, pady=10, column=1, sticky=W)
コード例 #7
0
    def __init__(self, master):

        plat = platform.system()
        if plat == 'Darwin':

            try:
                system(
                    '''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' '''
                )
                print("Trying to force Python window to the front on macOS")
            except:
                system(
                    '''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python2.7" to true' '''
                )
                print(
                    "Trying to force Python 2.7 window to the front on macOS")

        self.master = master
        frame = Frame(master)
        frame.config(background="#dcdcdc")
        frame.config(borderwidth=5, relief=GROOVE)
        frame.place(relx=0.5, rely=0.5, anchor=CENTER)
        master.title('Verify v. 0.2')  #   Main frame title
        master.config(background="#dcdcdc")
        master.geometry('820x750')
        menubar = Menu(master)
        """statmenu = Menu(menubar,tearoff=0)
        statmenu.add_command(label="Fieller", command=self.on_fieller)
        
        statmenu.rantest = Menu(statmenu)
        statmenu.rantest.add_command(label="Continuously variable data", command=self.on_rantest_continuous)
        statmenu.rantest.add_command(label="Binomial data (each result= yes or no)", command=self.on_rantest_binomial)
        statmenu.add_cascade(label="Randomisation test", menu=statmenu.rantest)
        
        statmenu.add_command(label="Help", command=self.on_help, state=DISABLED)
        statmenu.add_command(label="Quit", command=master.quit)
        
        menubar.add_cascade(label="Statistical Tests", menu=statmenu)
        master.config(menu=menubar)
      """
        b3 = Button(frame,
                    text="Load traces",
                    width=20,
                    command=self.callback3,
                    highlightbackground="#dcdcdc")
        b3.grid(row=0, column=0, columnspan=2, padx=10, pady=8, sticky=W)

        self.b4 = Button(frame,
                         text="Verify traces variance",
                         width=20,
                         state=DISABLED,
                         command=self.callback2,
                         highlightbackground="#dcdcdc")
        self.b4.grid(row=1, padx=10, pady=8, column=0, columnspan=2)

        self.b5 = Button(frame,
                         text="Plot Variance vs. current",
                         width=20,
                         state=DISABLED,
                         command=self.callback5,
                         highlightbackground="#dcdcdc")
        self.b5.grid(row=2, padx=10, pady=8, column=0, columnspan=2)

        #need to remove Pack to use separator
        s1 = Separator(frame, orient=VERTICAL)
        s1.grid(column=2, row=0, rowspan=40, pady=10, sticky=N + W + S)

        self.input_filename_label = StringVar()
        self.input_filename_label.set("No data loaded yet")
        self.l1 = Label(frame,
                        textvariable=self.input_filename_label,
                        width=40,
                        bg="#dcdcdc")
        self.l1.grid(row=0, column=2, columnspan=4, pady=5)

        Label(frame, text="Baseline range (pts)",
              bg="#dcdcdc").grid(row=1,
                                 column=2,
                                 columnspan=2,
                                 pady=5,
                                 sticky=E)
        self.br = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.br.grid(row=1, column=4, sticky=W, pady=5)
        self.br.insert(END, '0, 50')

        Label(frame, text="Decimation", bg="#dcdcdc").grid(row=2,
                                                           column=2,
                                                           columnspan=2,
                                                           pady=5,
                                                           sticky=E)
        self.de = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.de.grid(row=2, column=4, sticky=W, pady=5)
        self.de.insert(END, '1')

        Label(frame, text="Unitary current amplitude (pA)",
              bg="#dcdcdc").grid(row=3,
                                 column=2,
                                 columnspan=2,
                                 pady=5,
                                 sticky=E)
        self.ua = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.ua.grid(row=3, column=4, sticky=W, pady=5)
        self.ua.insert(END, '1')
        #default unitary current is 1 pA

        Label(frame, text="Output filename", bg="#dcdcdc").grid(row=4,
                                                                column=2,
                                                                columnspan=2,
                                                                pady=5)

        style = Style()
        style.theme_use('clam')
        style.configure("w.TRadiobutton",
                        padding=2,
                        background="#dcdcdc",
                        foreground="black",
                        width=15)
        style.configure("TRadiobutton",
                        padding=2,
                        background="#dcdcdc",
                        foreground="black",
                        width=8)

        MODES = [("verified.txt", 3), ("Save as...", 2), ("v_[infile]", 1),
                 ("[date:time]_v_[infile]", 0)]

        self.v = IntVar()
        self.v.set(0)  # initialize

        #note this is the ttk radiobutton, the tk one doesn't select at first
        for text, mode in MODES:
            b = Radiobutton(frame,
                            text=text,
                            command=self.callback_fname,
                            variable=self.v,
                            value=mode,
                            state=NORMAL)
            b.grid(row=5, padx=10, column=mode + 2, sticky=E)

        #the last button in the loop (0) is the wide one, so gets the wide style.
        b.configure(style='w.TRadiobutton')

        self.traceHost = Frame(frame)
        self.traceHost.grid(row=15, column=0, columnspan=3)
        self.p = Plot(self.traceHost)

        self.Host2D = Frame(frame)
        self.Host2D.grid(row=15, column=3, columnspan=3)
        self.pcv = Plot(self.Host2D)

        s2 = Separator(frame)
        s2.grid(row=25, columnspan=6, sticky=S + E + W)

        message = Message(frame,
                          text=self.introduction,
                          width=800,
                          font=("Courier", 12),
                          bg="#dcdcdc")
        message.grid(row=26, rowspan=8, columnspan=6, sticky=EW)

        s3 = Separator(frame)
        s3.grid(row=35, columnspan=6, sticky=E + W)

        version_text = "https://github.com/aplested/verify\nPython version:\t" + sys.version.replace(
            "\n", "\t")
        version = Message(frame,
                          width=800,
                          text=version_text,
                          justify=LEFT,
                          background="#dcdcdc",
                          font=("Courier", 12))
        version.grid(row=36, columnspan=5, sticky=EW)

        self.b6 = Button(frame,
                         text="Quit",
                         command=master.quit,
                         width=10,
                         highlightbackground="#dcdcdc")
        self.b6.grid(row=36, padx=10, pady=8, column=5, sticky=W)
コード例 #8
0
class StatusFrame(Frame):
    def __init__(self, parent, passfail, failtext):
        Frame.__init__(self, parent)
        self.status = StringVar()
        self.status_text = StringVar()

        self.statuslbl = Label(self,
                               textvariable=self.status,
                               style='Title.TLabel')
        self.statuslbl.grid(column=0, row=1, columnspan=2, padx=100, pady=10)

        self.bar = Separator(self, orient=HORIZONTAL)
        self.bar.grid(column=0,
                      row=2,
                      columnspan=2,
                      padx=5,
                      pady=5,
                      sticky='nsew')

        self.ok = Button(self, text='OK', command=self.OkBut, width=10)
        self.ok.grid(column=0, columnspan=2, row=4, padx=5, pady=5)

        if passfail == 'PASS':
            self.TestPassed()
        elif passfail == 'FAIL':
            self.TestFailed(failtext)
        else:
            self.status.set('What?????')

        self.grid()

        # Center the Window
        parent.update_idletasks()

        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(),
                                                 self.winfo_height(), xp, yp))

        parent.mainloop()

    def OkBut(self):
        self.quit()

    def StatusText(self, text):
        self.status_text.set(text)

    def TestInProgress(self):
        self.status.set('Test In Progress')
        self.statuslbl.configure(foreground='black')

    def TestPassed(self):
        self.status.set('Test PASSED')
        self.configure(background='green')
        self.statuslbl.configure(background='green', foreground='yellow')

    def TestFailed(self, text):
        self.status.set('Test FAIL')
        self.configure(background='red')
        self.statuslbl.configure(background='red', foreground='yellow')
        self.text = Text(self, relief=SUNKEN, width=110, height=16)
        self.text.grid(column=0,
                       row=3,
                       columnspan=2,
                       sticky='nsew',
                       padx=10,
                       pady=10)
        self.text.insert(INSERT, text)
コード例 #9
0
    def createFrame(self, root):
        'Creates main frame and data input field.'
        frame = Frame(root)
        frame.pack()
        frame.config(background="#dcdcdc")  #well, it has to be, right?
        #frame.geometry('480x700')

        message = Message(frame,
                          width=420,
                          text="\n" + RantestBinomial.introd,
                          font=("Helvetica", 12),
                          background="#dcdcdc")
        message.grid(row=0, column=0, rowspan=15, columnspan=4)
        s = Separator(frame, orient=HORIZONTAL)
        s.grid(columnspan=4, sticky=EW)

        frame_s1 = LabelFrame(frame, text="Sample 1", background="#dcdcdc")
        frame_s1.grid(row=16, rowspan=3, columnspan=4, padx=20, sticky=W)
        Label(frame_s1, text="Successes:", background="#dcdcdc").grid(row=0,
                                                                      column=0,
                                                                      padx=10,
                                                                      pady=10)
        Label(frame_s1, text="Failures:", background="#dcdcdc").grid(row=0,
                                                                     column=2,
                                                                     pady=10)

        frame_s2 = LabelFrame(frame, text="Sample 2", background="#dcdcdc")
        frame_s2.grid(row=20, rowspan=3, columnspan=4, padx=20, sticky=W)
        Label(frame_s2, text="Successes:", background="#dcdcdc").grid(row=0,
                                                                      column=0,
                                                                      padx=10,
                                                                      pady=10,
                                                                      sticky=E)
        Label(frame_s2, text="Failures:", background="#dcdcdc").grid(row=0,
                                                                     column=2,
                                                                     pady=10)

        e = []
        e1 = Entry(frame_s1, justify=CENTER, width=10)
        e1.grid(row=0, column=1, padx=10)
        e1.insert(END, '3')
        e.append(e1)

        e2 = Entry(frame_s1, justify=CENTER, width=10)
        e2.grid(row=0, column=3, padx=20)
        e2.insert(END, '4')
        e.append(e2)

        e3 = Entry(frame_s2, justify=CENTER, width=10)
        e3.grid(row=0, column=1, padx=10)
        e3.insert(END, '4')
        e.append(e3)

        e4 = Entry(frame_s2, justify=CENTER, width=10)
        e4.grid(row=0, column=3, padx=20)
        e4.insert(END, '5')
        e.append(e4)

        #Label(frame, text="").grid(row=23, column=0, columnspan=2)
        Label(frame, text="Number of randomisations:",
              background="#dcdcdc").grid(row=24,
                                         column=0,
                                         columnspan=3,
                                         pady=5)

        e5 = Entry(frame, justify=CENTER, width=15)
        e5.grid(row=24, column=3, pady=5, sticky=W)
        e5.insert(END, '5000')
        e.append(e5)

        #Label(frame, text="").grid(row=25, column=0, columnspan=2)
        b1 = Button(frame,
                    text="Calculate",
                    command=self.calback1,
                    highlightbackground="#dcdcdc").grid(row=26,
                                                        columnspan=4,
                                                        pady=5)
        #Label(frame, text="").grid(row=27, column=0, columnspan=4)

        txt = Text(frame)
        txt.grid(row=28, column=0, columnspan=4)
        txt.config(width=64, height=18, font=("Courier", "12"))
        txt.insert(END, "Results will appear here")

        #Label(frame, text="").grid(row=29, column=0, columnspan=4)
        b3 = Button(frame,
                    text="Plot Distribution",
                    command=self.calback2,
                    highlightbackground="#dcdcdc").grid(row=40,
                                                        columnspan=4,
                                                        pady=10)
        #Label(frame, text="").grid(row=30, column=0, columnspan=4)

        self.frame = frame
        self.e = e
        self.txt = txt
コード例 #10
0
ファイル: entry_frame.py プロジェクト: ubnt-marty/testlib
class PromptFrame(Frame):
    def __init__(self,
                 parent,
                 question,
                 yestxt="Yes",
                 notxt='No',
                 title='Default'):
        Frame.__init__(self, parent)
        self.answer = StringVar()
        #        yestxt = "Start Test"
        #        notxt  = "Exit Test"
        self.title = Label(self, text=title, style='Title.TLabel')
        self.title.grid(column=0, row=0, padx=10, pady=10)
        self.question = Label(self, text=question, style='Title.TLabel')
        self.question.grid(column=0, row=1, padx=10, pady=10, sticky='w')
        #        self.entry = Entry( self, width=25, textvariable=self.answer ); self.entry.grid(column=0, row=1, padx=10)
        #        self.entry.select_range(0,END)
        #        self.entry.icursor(END)
        #        self.entry.bind('<Return>', func=lambda e: self.quit())
        #        self.entry.focus_force()

        self.bar = Separator(self, orient=HORIZONTAL)
        self.bar.grid(column=0,
                      row=2,
                      columnspan=2,
                      padx=5,
                      pady=5,
                      sticky='nsew')

        self.ok = Button(self,
                         text=yestxt,
                         style='TButton',
                         command=self.ButtonYes)
        self.ok.grid(column=0, row=2, padx=5, pady=5, sticky='w')
        self.no = Button(self,
                         text=notxt,
                         style='TButton',
                         command=self.ButtonNo)
        self.no.grid(column=0, row=2, padx=5, pady=5, sticky='e')
        self.ok.bind('<Return>', func=lambda e: self.ButtonYes())
        self.ok.focus_force()

        self.grid()

        # Center the Window
        parent.update_idletasks()
        xp = (parent.winfo_screenwidth() / 2) - (self.winfo_width() / 2) - 8
        yp = (parent.winfo_screenheight() / 2) - (self.winfo_height() / 2) - 20
        parent.geometry('{0}x{1}+{2}+{3}'.format(self.winfo_width(),
                                                 self.winfo_height(), xp, yp))

        self.update()
        parent.mainloop()

    def OkBut(self):
        self.answer.set("OK")
        self.quit()

    def ButtonYes(self):
        self.answer.set(True)
        self.quit()

    def ButtonNo(self):
        self.answer.set(False)
        self.quit()
コード例 #11
0
ファイル: main.py プロジェクト: alex-kooper/languages
 def add_separator(self, row, padx=7, pady=7):
     s = Separator(self, orient=HORIZONTAL)
     s.grid(row=row, columnspan=3, padx=padx, pady=pady, sticky=(W, E))
コード例 #12
0
 def add_separator(self, row, padx=7, pady=7):
     s = Separator(self, orient=HORIZONTAL)
     s.grid(row=row, columnspan=3, padx=padx, pady=pady, sticky=(W, E))