def __init__(self, workspace): Tk.__init__(self) self.wm_title("BlueP") self.workspace = workspace graph_frame = Frame(self, width=600, height=400) graph_frame.pack(side=TOP, pady=4, fill=BOTH, expand=1) self.execution_frame = ExecutionFrame(self) self.execution_frame.pack(side=BOTTOM, pady=4, fill=BOTH) action_frame = Frame(graph_frame) action_frame.pack(side=LEFT, padx=4) schema_frame = Frame(graph_frame) schema_frame.pack(side=RIGHT, fill=BOTH, expand=1) self.module_schema = ModuleSchema(schema_frame, workspace, background="#fff5cc") self.module_schema.pack(fill=BOTH, expand=1) action_bar_manager = ActionBarManager(action_frame, self.module_schema, self) utils.center_window(self, DEFAULT_WIDTH, DEFAULT_HEIGHT) self.mainloop()
def __init__(self, parent, text, title="Information"): self.parent = parent if self.parent is None: self.dialog = Tk() else: self.dialog = Toplevel(self.parent) self.dialog.wm_title(title) field_frame = Frame(self.dialog) field_frame.pack(side=TOP, fill=Y, expand=1) button_frame = Frame(self.dialog) button_frame.pack(side=BOTTOM) label = Label(field_frame, text=text) label.pack(side=LEFT) ok_button = Button(button_frame, text="OK", command=self.ok_action) ok_button.pack(side=LEFT) self.dialog.bind("<Return>", self.ok_action) self.dialog.bind("<Escape>", self.ok_action) utils.center_window(self.dialog, DIALOG_WIDTH, DIALOG_HEIGHT) if self.parent is None: self.dialog.mainloop()
def __init__(self, workspace): Tk.__init__(self) self.wm_title("BlueP") self.workspace = workspace graph_frame = Frame(self, width=600, height=400) graph_frame.pack(side=TOP, pady=4, fill=BOTH, expand=1) self.execution_frame = ExecutionFrame(self) self.execution_frame.pack(side=BOTTOM, pady=4, fill=BOTH) action_frame = Frame(graph_frame) action_frame.pack(side=LEFT, padx=4) schema_frame = Frame(graph_frame) schema_frame.pack(side=RIGHT, fill=BOTH, expand=1) self.module_schema = ModuleSchema(schema_frame, workspace, background='#fff5cc') self.module_schema.pack(fill=BOTH, expand=1) action_bar_manager = ActionBarManager(action_frame, self.module_schema, self) utils.center_window(self, DEFAULT_WIDTH, DEFAULT_HEIGHT) self.mainloop()
def __init__(self, parent, title, field_name, optional_field_name=None, opt_placeholder=""): self.parent = parent if self.parent is None: self.dialog = Tk() else: self.dialog = Toplevel(self.parent) self.dialog.wm_title(title) fields_frame = Frame(self.dialog) fields_frame.pack(side=TOP, fill=Y, expand=1) field_frame = Frame(fields_frame) field_frame.pack(side=TOP, fill=Y, expand=1) if optional_field_name is not None: opt_field_frame = Frame(fields_frame) opt_field_frame.pack(side=BOTTOM, fill=Y, expand=1) button_frame = Frame(self.dialog) button_frame.pack(side=BOTTOM) label = Label(field_frame, text=field_name) label.pack(side=LEFT) self.entry = Entry(field_frame, width=50) self.entry.pack(side=RIGHT) if optional_field_name is not None: opt_label = Label(opt_field_frame, text=optional_field_name) opt_label.pack(side=LEFT) self.opt_entry = Entry(opt_field_frame, width=50) self.opt_entry.insert(0, opt_placeholder) self.opt_entry.pack(side=RIGHT) else: self.opt_entry = None ok_button = Button(button_frame, text="OK", command=self.ok_action) ok_button.pack(side=LEFT) cancel_button = Button(button_frame, text="cancel", command=self.cancel_action) cancel_button.pack(side=RIGHT) self.field_value = None self.opt_field_value = None self.dialog.bind("<Return>", self.ok_action) self.dialog.bind("<Escape>", self.cancel_action) utils.center_window(self.dialog, DIALOG_WIDTH, DIALOG_HEIGHT) self.entry.focus() if self.parent is None: self.dialog.mainloop()