def createWindowTrace(self, title, n): width = str(n * 200 + 50) # print "WIIDTH " + str(width) # print "LEN " + str(len(self.states[0].thread_set)) self.win_list[title] = tk.Tk() self.win_list[title].wm_title(title) self.win_list[title].geometry(width+"x650+20+10") f = tk.Frame(self.win_list[title]) f.pack(side=tk.TOP, anchor=tk.NW, padx=5, pady=2) l = tk.Label(f) text = "Shared Variable: " for x in self.states[0].global_var: text += x + " " l.configure(text=text, relief=tk.RIDGE) l.pack(side=tk.TOP, anchor=tk.NW) sep = ttk.Separator(self.win_list[title], orient="horizontal") sep.pack(fill=tk.X, padx=5, pady=2) self.win_list[title].frame = VerticalScrolledFrame.VerticalScrolledFrame(self.win_list[title]) self.win_list[title].frame.pack(fill=tk.BOTH, expand=1) sep2 = ttk.Separator(self.win_list[title], orient="horizontal") sep2.pack(fill=tk.X, padx=5, pady=2) b = ttk.Button(self.win_list[title], text="Exit", command=self.win_list[title].destroy) b.pack(side=tk.RIGHT, padx=5, pady=5) b = ttk.Button(self.win_list[title], text="Save", command=lambda: self.save_visual_Trace()) b.pack(side=tk.RIGHT, padx=5, pady=5) b = ttk.Button(self.win_list[title], text="Restart", command=lambda: self.resetTrace(title)) b.pack(side=tk.LEFT, padx=5, pady=5) b = ttk.Button(self.win_list[title], text="Previus", command=lambda: self.PrintPreviusState(title)) b.pack(side=tk.LEFT, padx=5, pady=5) b = ttk.Button(self.win_list[title], text="Next", command=lambda: self.PrintNextState(title)) b.pack(side=tk.LEFT, padx=5, pady=5) l = tk.Label(self.win_list[title]) l.configure(text="| Next For: ") l.pack(side=tk.LEFT, padx=5, pady=5) OPTIONS = [ "Istruction", "Context Switch", "Round" ] self.step_mode = tk.StringVar(self.win_list[title]) self.step_mode.set(OPTIONS[0]) # default value #variable.trace("w", self.PrintNextState()) w = apply(tk.OptionMenu, (self.win_list[title], self.step_mode) + tuple(OPTIONS)) w.pack(side=tk.LEFT, padx=5, pady=5)
def showTrace(self, output): self.win_list["Textual Trace"] = tk.Tk() self.win_list["Textual Trace"].wm_title("Textual Trace") self.win_list["Textual Trace"].frame = VerticalScrolledFrame.VerticalScrolledFrame(self.win_list["Textual Trace"]) self.win_list["Textual Trace"].frame.pack(fill=tk.BOTH, expand=1) sep = ttk.Separator(self.win_list["Textual Trace"], orient="horizontal") sep.pack(fill=tk.X, padx=5, pady=2) b = ttk.Button(self.win_list["Textual Trace"], text="Close", command=self.win_list["Textual Trace"].destroy) b.pack(side=tk.RIGHT, padx=5, pady=5) text = tk.Label(self.win_list["Textual Trace"].frame.interior) text.grid(row=0, column=0) text.configure(width=100, justify=tk.LEFT, anchor=tk.NW, text=output)
def initUI(self): self.rowconfigure(0, pad=3, weight=1) self.columnconfigure(0, pad=3, weight=1) # Create a vertically scrolling frame to hold all of the limb frames self.scrollFrame = VerticalScrolledFrame(self, background="white") # Generate a limb frame for each limb in the robot for limb in self.robot.getLimbs(): newLimbFrame = LimbFrame(self.scrollFrame.interior, limb) newLimbFrame.grid(row=len(self.limbFrames), column=0) self.limbFrames.append(newLimbFrame) # Set the scrolling frame to fill the window self.scrollFrame.grid(row=0, column=0, sticky=N+S+W+E) # Add a button to store the state of the robot in the active macro self.btnSaveState = Button(self, text="Save State", command=self.saveState) self.btnSaveState.grid(row=1, column=0)
def createWindowCode(self, path): self.win_list[path] = tk.Tk() self.win_list[path].wm_title(path) self.win_list[path].geometry("520x650+10+600") self.win_list[path].frame = VerticalScrolledFrame.VerticalScrolledFrame(self.win_list[path]) self.win_list[path].frame.pack(fill=tk.BOTH, expand=1) sep = ttk.Separator(self.win_list[path], orient="horizontal") sep.pack(fill=tk.X, padx=5, pady=2) b = ttk.Button(self.win_list[path], text="Exit", command=self.win_list[path].destroy) b.pack(side=tk.RIGHT, padx=5, pady=5) source = open(path, "r") lines = (source.read()).split('\n') i = 0 for line in lines: text = tk.Label(self.win_list[path].frame.interior) text.grid(row=i, column=0) if i % 2 == 0: text.configure(bg="#D3D3D3") text.configure(width=100, justify=tk.LEFT, anchor=tk.NW, text=str(i + 1) + "|\t" + line) i = i + 1
def configurarVista(self): self.scrollPrincipal = VerticalScrolledFrame(parent=self, alto=480) self.scrollPrincipal.pack() self.scrollPrincipal.config(bg=COLOR_PRINCIPAL) self.scrollPrincipal.interior.config(bg=COLOR_PRINCIPAL) Label(self.scrollPrincipal.interior, text="Polinomio interpolante", bg=COLOR_PRINCIPAL, pady=5, font=FONT_TITULO).pack() self.config(bg=COLOR_PRINCIPAL) Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL).pack() # Espacio, se me bugueo el grid self.lPolinomio = Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL, wraplength=800) self.lPolinomio.pack() #modifique arriba # Frame datos self.frameDatos = Frame(self.scrollPrincipal.interior, bg=COLOR_PRINCIPAL) self.frameDatos.pack() self.lMetodo = Label(self.frameDatos, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL) self.lMetodo.grid(row=0, column=0) self.lGrado = Label(self.frameDatos, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL) self.lGrado.grid(row=1, column=0) self.lEspaciado = Label(self.frameDatos, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL) self.lEspaciado.grid(row=2, column=0) Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL).pack() # Espacio, se me bugueo el grid # Frame pasos self.framePasos = LabelFrame(self.scrollPrincipal.interior, text='Pasos:', bg=COLOR_SECUNDARIO, font=FONT_PRINCIPAL_BOLD) self.framePasos.pack() self.labelsPasos = [] self.scroll = VerticalScrolledFrame(parent=self.framePasos, alto=200) self.scroll.pack() self.scroll.interior.config(bg=COLOR_SECUNDARIO) Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL, wraplength=800).pack() # Espacio, se me bugueo el grid # Frame calcular en punto self.framePunto = LabelFrame(self.scrollPrincipal.interior, text='Especializar en valor', bg=COLOR_SECUNDARIO, bd=0, font=FONT_PRINCIPAL_BOLD, padx=5) self.framePunto.pack() Label(self.framePunto, text="Punto: ", bg=COLOR_SECUNDARIO, font=FONT_PRINCIPAL).grid(row=0, column=0) self.punto = Entry(self.framePunto) self.punto.grid(row=0, column=1, padx=5) self.boton = Button( self.framePunto, text="Calcular", bd=1, bg="springGreen2", activebackground="springGreen3", command=lambda: self.calcularImagen(self.punto.get())) self.boton.grid(row=0, column=2) self.lImagen = Label(self.framePunto, text="Imagen: ", bg=COLOR_SECUNDARIO, font=FONT_PRINCIPAL) self.lImagen.grid(row=1, column=0) self.mensajePunto = Label(self.framePunto, text="", bg=COLOR_SECUNDARIO, fg=COLOR_ERROR) self.mensajePunto.grid(row=2, column=0, columnspan=3) # Espacio, se me bugueo el grid Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL).pack() # Espacio, se me bugueo el grid # Frame botones self.frameBotones = Frame(self.scrollPrincipal.interior, bg=COLOR_PRINCIPAL) self.frameBotones.pack() self.boton = Button( self.frameBotones, text="Alterar valores", bd=1, bg="firebrick2", activebackground="firebrick3", command=lambda: self.controlador.mostrarFrame(VistaInicial)) self.boton.grid(row=0, column=0, padx=10) self.boton = Button(self.frameBotones, text="Finalizar", bd=1, bg="firebrick2", activebackground="firebrick3", command=self.controlador.destroy) self.boton.grid(row=0, column=1) self.lCambio = Label(self.scrollPrincipal.interior, text="", bg=COLOR_PRINCIPAL, font=FONT_PRINCIPAL) self.lCambio.pack() return self.scrollPrincipal