Python Tkinter.LEFT Examples
The following are 30
code examples of Tkinter.LEFT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Tkinter
, or try the search function
.
Example #1
Source File: backend_tkagg.py From Computable with MIT License | 6 votes |
def showtip(self, text): "Display text in tooltip window" self.text = text if self.tipwindow or not self.text: return x, y, _, _ = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 27 y = y + self.widget.winfo_rooty() self.tipwindow = tw = Tk.Toplevel(self.widget) tw.wm_overrideredirect(1) tw.wm_geometry("+%d+%d" % (x, y)) try: # For Mac OS tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w, "help", "noActivates") except Tk.TclError: pass label = Tk.Label(tw, text=self.text, justify=Tk.LEFT, background="#ffffe0", relief=Tk.SOLID, borderwidth=1, ) label.pack(ipadx=1)
Example #2
Source File: gui_widgets.py From SVPV with MIT License | 6 votes |
def genotypes(self, sv, vcf_samples, run_samples): message = '' line = '' for i, gt in enumerate(sv.GTs): if '1' in gt: if vcf_samples[i] in run_samples: this = '%s:%s' % (vcf_samples[i], gt) if len(line) == 0: line = this elif len(this) + len(line) >= 50: message += line + ',\n' line = this else: line += ', %s' % this message += line self.message.config(text=message, bg='white', width=55, justify=tk.LEFT) # class for multiple listboxes linked by single scroll bar
Example #3
Source File: gui_widgets.py From SVPV with MIT License | 6 votes |
def __init__(self, parent): tk.LabelFrame.__init__(self, parent) self.title = tk.Label(self, text='SV Length') self.len_GT_On = tk.IntVar(value=0) self.len_GT_On_CB = tk.Checkbutton(self, text=">", justify=tk.LEFT, variable=self.len_GT_On) self.len_GT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3) self.len_GT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3) self.len_LT_On = tk.IntVar(value=0) self.len_LT_On_CB = tk.Checkbutton(self, text="<", justify=tk.LEFT, variable=self.len_LT_On) self.len_LT_val = tk.Spinbox(self, values=(1,5,10,50,100,500), width=3) self.len_LT_Units = tk.Spinbox(self, values=("bp", "kbp", "Mbp"), width=3) self.title.grid(row=0, column=0, sticky=tk.EW, columnspan=4) self.len_GT_On_CB.grid(row=1, column=0, sticky=tk.EW) self.len_GT_val.grid(row=2, column=0, sticky=tk.EW) self.len_GT_Units.grid(row=2, column=1, sticky=tk.EW) self.len_LT_On_CB.grid(row=1, column=2, sticky=tk.EW) self.len_LT_val.grid(row=2, column=2, sticky=tk.EW) self.len_LT_Units.grid(row=2, column=3, sticky=tk.EW)
Example #4
Source File: pcwg_tool_reborn.py From PCWG with MIT License | 6 votes |
def buttonbox(self): try: self.attributes("-toolwindow",1) #only works on windows except: #self.overrideredirect(1) #removes whole frame self.resizable(0,0) #stops maximising and resizing but can still be minimised box = tk.Frame(self) w = tk.Button(box, text="Don't Save", width=10, command=self.close_dont_save) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(box, text="Cancel", width=10, command=self.cancel) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(box, text="Save", width=10, command=self.close_and_save, default=tk.ACTIVE) w.pack(side=tk.LEFT, padx=5, pady=5) self.bind("<Return>", self.close_and_save) self.bind("<Escape>", self.cancel) box.pack()
Example #5
Source File: backend_tkagg.py From matplotlib-4-abaqus with MIT License | 6 votes |
def showtip(self, text): "Display text in tooltip window" self.text = text if self.tipwindow or not self.text: return x, y, _, _ = self.widget.bbox("insert") x = x + self.widget.winfo_rootx() + 27 y = y + self.widget.winfo_rooty() self.tipwindow = tw = Tk.Toplevel(self.widget) tw.wm_overrideredirect(1) tw.wm_geometry("+%d+%d" % (x, y)) try: # For Mac OS tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w, "help", "noActivates") except Tk.TclError: pass label = Tk.Label(tw, text=self.text, justify=Tk.LEFT, background="#ffffe0", relief=Tk.SOLID, borderwidth=1, ) label.pack(ipadx=1)
Example #6
Source File: closable_Tab_with_menu.py From PCWG with MIT License | 6 votes |
def __init__(self, parent): scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL) self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED) scrollbar.configure(command=self.listbox.yview) self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5) scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
Example #7
Source File: closable_Tab_with_menu.py From PCWG with MIT License | 6 votes |
def buttonbox(self): try: self.attributes("-toolwindow",1) #only works on windows except: #self.overrideredirect(1) #removes whole frame self.resizable(0,0) #stops maximising and resizing but can still be minimised box = tk.Frame(self) w = tk.Button(box, text="Don't Save", width=10, command=self.close_dont_save) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(box, text="Cancel", width=10, command=self.cancel) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(box, text="Save", width=10, command=self.close_and_save, default=tk.ACTIVE) w.pack(side=tk.LEFT, padx=5, pady=5) self.bind("<Return>", self.close_and_save) self.bind("<Escape>", self.cancel) box.pack()
Example #8
Source File: tk_simple_dialog.py From PCWG with MIT License | 6 votes |
def buttonbox(self, box): # add standard button box. override if you don't want the # standard buttons frame = tk.Frame(box) frame.pack() w = tk.Button(frame, text="OK", width=10, command=self.ok, default=tk.ACTIVE) w.pack(side=tk.LEFT, padx=5, pady=5) w = tk.Button(frame, text="Cancel", width=10, command=self.cancel) w.pack(side=tk.LEFT, padx=5, pady=5) self.bind("<Return>", self.ok) self.bind("<Escape>", self.cancel) # # standard button semantics
Example #9
Source File: CallTipWindow.py From oss-ftp with MIT License | 6 votes |
def _calltip_window(parent): # htest # from Tkinter import Toplevel, Text, LEFT, BOTH top = Toplevel(parent) top.title("Test calltips") top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150)) text = Text(top) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") top.update() calltip = CallTip(text) def calltip_show(event): calltip.showtip("(s=Hello world)", "insert", "end") def calltip_hide(event): calltip.hidetip() text.event_add("<<calltip-show>>", "(") text.event_add("<<calltip-hide>>", ")") text.bind("<<calltip-show>>", calltip_show) text.bind("<<calltip-hide>>", calltip_hide) text.focus_set()
Example #10
Source File: btcrseed.py From btcrecover with GNU General Public License v2.0 | 6 votes |
def show_mnemonic_gui(mnemonic_sentence): """may be called *after* main() to display the successful result iff the GUI is in use :param mnemonic_sentence: the mnemonic sentence that was found :type mnemonic_sentence: unicode :rtype: None """ assert tk_root global pause_at_exit padding = 6 tk.Label(text="WARNING: seed information is sensitive, carefully protect it and do not share", fg="red") \ .pack(padx=padding, pady=padding) tk.Label(text="Seed found:").pack(side=tk.LEFT, padx=padding, pady=padding) entry = tk.Entry(width=80, readonlybackground="white") entry.insert(0, mnemonic_sentence) entry.config(state="readonly") entry.select_range(0, tk.END) entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=padding, pady=padding) tk_root.deiconify() tk_root.lift() entry.focus_set() tk_root.mainloop() # blocks until the user closes the window pause_at_exit = False
Example #11
Source File: SikuliGui.py From lackey with MIT License | 6 votes |
def __init__(self, master, textvariable=None, *args, **kwargs): tk.Frame.__init__(self, master) # Init GUI self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs) self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self._y_scrollbar.config(command=self._text_widget.yview) self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y) if textvariable is not None: if not isinstance(textvariable, tk.Variable): raise TypeError("tkinter.Variable type expected, {} given.".format( type(textvariable))) self._text_variable = textvariable self.var_modified() self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified) self._var_trace = textvariable.trace("w", self.var_modified)
Example #12
Source File: CallTipWindow.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def _calltip_window(parent): # htest # from Tkinter import Toplevel, Text, LEFT, BOTH top = Toplevel(parent) top.title("Test calltips") top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150)) text = Text(top) text.pack(side=LEFT, fill=BOTH, expand=1) text.insert("insert", "string.split") top.update() calltip = CallTip(text) def calltip_show(event): calltip.showtip("(s=Hello world)", "insert", "end") def calltip_hide(event): calltip.hidetip() text.event_add("<<calltip-show>>", "(") text.event_add("<<calltip-hide>>", ")") text.bind("<<calltip-show>>", calltip_show) text.bind("<<calltip-hide>>", calltip_hide) text.focus_set()
Example #13
Source File: components.py From SEM with MIT License | 6 votes |
def __init__(self, root, main_window, button_opt): ttk.Frame.__init__(self, root) self.root = root self.main_window = main_window self.current_files = None self.button_opt = button_opt # define options for opening or saving a file self.file_opt = options = {} options['defaultextension'] = '.txt' options['filetypes'] = [('all files', '.*'), ('text files', '.txt')] options['initialdir'] = os.path.expanduser("~") options['parent'] = root options['title'] = 'Select files to annotate.' self.file_selector_button = ttk.Button(self.root, text=u"select file(s)", command=self.filenames) self.label = ttk.Label(self.root, text=u"selected file(s):") self.fa_search = tkinter.PhotoImage(file=os.path.join(self.main_window.resource_dir, "images", "fa_search_24_24.gif")) self.file_selector_button.config(image=self.fa_search, compound=tkinter.LEFT) self.scrollbar = ttk.Scrollbar(self.root) self.selected_files = tkinter.Listbox(self.root, yscrollcommand=self.scrollbar.set) self.scrollbar.config(command=self.selected_files.yview)
Example #14
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
def __init__(self, parent): tk.LabelFrame.__init__(self, parent) self.type_var = tk.IntVar(value=0) self.radio_buttons = [tk.Radiobutton(self, text='All', justify=tk.LEFT, variable=self.type_var, value=0)] self.radio_buttons[-1].grid(row=0, column=0, sticky=tk.W) r=1 c=0 for i in range(1, len(SvTypeFilter.types)): self.radio_buttons.append(tk.Radiobutton(self, text=SvTypeFilter.types[i], justify=tk.LEFT, variable=self.type_var, value=i)) self.radio_buttons[-1].grid(row=r, column=c, sticky=tk.W) r += 1 if r > 3: r = 0 c += 1
Example #15
Source File: strap_beam_gui.py From Structural-Engineering with BSD 3-Clause "New" or "Revised" License | 5 votes |
def strap_design_frame_builder(self): self.strap_inputs_frame = tk.Frame(self.strap_design_frame) self.strap_inputs_frame.pack(side=tk.LEFT, anchor='nw') self.strap_calc_frame = tk.Frame(self.strap_design_frame) self.strap_calc_frame.pack(side=tk.RIGHT ,anchor='ne', fill=tk.BOTH, expand=1) tk.Label(self.strap_inputs_frame, text="B = ", font=self.helv).grid(row=0, column=0, sticky = tk.E) tk.Entry(self.strap_inputs_frame, textvariable=self.bs, width=10, validate="key", validatecommand=self.reset_status).grid(row=0, column=1) tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=0, column=2) tk.Label(self.strap_inputs_frame, text="H = ", font=self.helv).grid(row=1, column=0, sticky = tk.E) tk.Entry(self.strap_inputs_frame, textvariable=self.hs, width=10, validate="key", validatecommand=self.reset_status).grid(row=1, column=1) tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=1, column=2) self.strap_vbar_size = tk.StringVar() self.inputs.append(self.strap_vbar_size) self.strap_vbar_size.set('3') self.strap_vbar_size_label = tk.Label(self.strap_inputs_frame, text="Shear\nBar Size (#) : ", font=self.helv) self.strap_vbar_size_label.grid(row=2,column=0, pady=2) self.strap_vbar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_vbar_size, '3', '4', '5', command=self.reset_status) self.strap_vbar_size_menu.config(font=self.helv) self.strap_vbar_size_menu.grid(row=2, column=1, padx= 2, sticky=tk.W) self.strap_bar_size = tk.StringVar() self.inputs.append(self.strap_bar_size) self.strap_bar_size.set('3') self.strap_bar_size_label = tk.Label(self.strap_inputs_frame, text="Flexure\nBar Size (#) : ", font=self.helv) self.strap_bar_size_label.grid(row=4,column=0, pady=2) self.strap_bar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_bar_size, '3', '4', '5','6','7','8','9','10','11','14','18', command=self.reset_status) self.strap_bar_size_menu.config(font=self.helv) self.strap_bar_size_menu.grid(row=4, column=1, padx= 2, sticky=tk.W) self.strap_calc_txtbox = tk.Text(self.strap_calc_frame, height = 25, width = 70, bg= "grey90", font= self.helv_norm, wrap=tk.WORD) self.strap_calc_txtbox.grid(row=0, column=0, sticky='nsew') self.strap_scroll = tk.Scrollbar(self.strap_calc_frame, command=self.strap_calc_txtbox.yview) self.strap_scroll.grid(row=0, column=1, sticky='nsew') self.strap_calc_txtbox['yscrollcommand'] = self.strap_scroll.set
Example #16
Source File: record.py From TensorKart with MIT License | 5 votes |
def create_main_panel(self): # Panels top_half = tk.Frame(self.root) top_half.pack(side=tk.TOP, expand=True, padx=5, pady=5) message = tk.Label(self.root, text="(Note: UI updates are disabled while recording)") message.pack(side=tk.TOP, padx=5) bottom_half = tk.Frame(self.root) bottom_half.pack(side=tk.LEFT, padx=5, pady=10) # Images self.img_panel = tk.Label(top_half, image=ImageTk.PhotoImage("RGB", size=IMAGE_SIZE)) # Placeholder self.img_panel.pack(side = tk.LEFT, expand=False, padx=5) # Joystick self.init_plot() self.PlotCanvas = FigCanvas(figure=self.fig, master=top_half) self.PlotCanvas.get_tk_widget().pack(side=tk.RIGHT, expand=False, padx=5) # Recording textframe = tk.Frame(bottom_half, width=332, height=15, padx=5) textframe.pack(side=tk.LEFT) textframe.pack_propagate(0) self.outputDirStrVar = tk.StringVar() self.txt_outputDir = tk.Entry(textframe, textvariable=self.outputDirStrVar, width=100) self.txt_outputDir.pack(side=tk.LEFT) self.outputDirStrVar.set("samples/" + datetime.now().strftime('%Y-%m-%d_%H:%M:%S')) self.record_button = ttk.Button(bottom_half, text="Record", command=self.on_btn_record) self.record_button.pack(side = tk.LEFT, padx=5)
Example #17
Source File: CallTipWindow.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def showtip(self, text, parenleft, parenright): """Show the calltip, bind events which will close it and reposition it. """ # Only called in CallTips, where lines are truncated self.text = text if self.tipwindow or not self.text: return self.widget.mark_set(MARK_RIGHT, parenright) self.parenline, self.parencol = map( int, self.widget.index(parenleft).split(".")) self.tipwindow = tw = Toplevel(self.widget) self.position_window() # remove border on calltip window tw.wm_overrideredirect(1) try: # This command is only needed and available on Tk >= 8.4.0 for OSX # Without it, call tips intrude on the typing process by grabbing # the focus. tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w, "help", "noActivates") except TclError: pass self.label = Label(tw, text=self.text, justify=LEFT, background="#ffffe0", relief=SOLID, borderwidth=1, font = self.widget['font']) self.label.pack() tw.lift() # work around bug in Tk 8.5.18+ (issue #24570) self.checkhideid = self.widget.bind(CHECKHIDE_VIRTUAL_EVENT_NAME, self.checkhide_event) for seq in CHECKHIDE_SEQUENCES: self.widget.event_add(CHECKHIDE_VIRTUAL_EVENT_NAME, seq) self.widget.after(CHECKHIDE_TIME, self.checkhide_event) self.hideid = self.widget.bind(HIDE_VIRTUAL_EVENT_NAME, self.hide_event) for seq in HIDE_SEQUENCES: self.widget.event_add(HIDE_VIRTUAL_EVENT_NAME, seq)
Example #18
Source File: tkmktap.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def __init__(self, master, lines, label, desc, default, cmd, **kw): Tkinter.Frame.__init__(self, master, relief='raised', bd=1, **kw) self.lines = lines l = Tkinter.Label( self, text=label, wraplen=200, width=30, anchor='w', justify='left' ) s = Tkinter.StringVar() if default: s.set(default) self.entry = Tkinter.Entry(self, text=s, background='white') self.flag = label more = Tkinter.Button( self, text='+', command=lambda f = cmd, a = label, b = default, c = desc: f(a, b, c) ) l.pack(side=Tkinter.LEFT, fill='y') self.entry.pack(side=Tkinter.LEFT) more.pack(side=Tkinter.LEFT) l.bind("<Enter>", self.highlight) l.bind("<Leave>", self.unhighlight) l.bind("<ButtonPress-1>", self.press) l.bind("<B1-ButtonRelease>", self.release) l.bind("<B1-Motion>", self.motion)
Example #19
Source File: pcwg_tool_reborn.py From PCWG with MIT License | 5 votes |
def __init__(self, parent): scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL) self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED) scrollbar.configure(command=self.listbox.yview) self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5) scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
Example #20
Source File: __init__.py From PyMsgBox with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _bindArrows(tempButton) tempButton.pack( expand=tk.YES, side=tk.LEFT, padx="1m", pady="1m", ipadx="2m", ipady="1m" ) # remember the text associated with this widget __widgetTexts[tempButton] = buttonText # remember the first widget, so we can put the focus there if i == 0: __firstWidget = tempButton i = 1 # for the commandButton, bind activation events to the activation event handler commandButton = tempButton handler = __buttonEvent for selectionEvent in STANDARD_SELECTION_EVENTS: commandButton.bind("<%s>" % selectionEvent, handler) if CANCEL_TEXT in choices: commandButton.bind("<Escape>", __cancelButtonEvent)
Example #21
Source File: app.py From subfinder with MIT License | 5 votes |
def _create_widgets(self): self.button_open_file = tk.Button( self, text='选择文件', command=self._open_file) self.button_open_file.grid(row=0, column=0, sticky='nswe') self.button_open_directory = tk.Button( self, text='选择目录', command=self._open_directory) self.button_open_directory.grid(row=0, column=1, sticky='nswe') frame = tk.Frame(self) self.label = tk.Label(frame, text='选中的文件或目录:') self.label.pack(side=tk.LEFT) self.label_selected = tk.Label(frame, text=self.videofile) self.label_selected.pack(side=tk.LEFT) frame.grid(row=1, column=0, columnspan=2, sticky='nswe') self.button_start = tk.Button(self, text='开始', command=self._start) self.button_start.grid( row=2, column=0, columnspan=2, pady=20, sticky='nswe') frame = tk.Frame(self) self.text_logger = tk.Text(frame) self.scrollbar = tk.Scrollbar(frame, command=self.text_logger.yview) self.text_logger.configure(yscrollcommand=self.scrollbar.set) self.text_logger.grid(row=0, column=0, sticky='nswe') self.scrollbar.grid(row=0, column=1, sticky='ns') tk.Grid.rowconfigure(self, 0, weight=1) tk.Grid.columnconfigure(frame, 0, weight=1) # tk.Grid.columnconfigure(frame, 1, weight=1) frame.grid(row=3, column=0, columnspan=2, pady=20, sticky='nswe') self._output = OutputStream(self.text_logger) self.after(100, self._display_msg) tk.Grid.rowconfigure(self, 3, weight=1) tk.Grid.columnconfigure(self, 0, weight=1) tk.Grid.columnconfigure(self, 1, weight=1)
Example #22
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
def __init__(self, parent, message): tk.LabelFrame.__init__(self, parent, text="Info") self.message = tk.Label(self, text=message, bg='white', width=55, justify=tk.LEFT) self.message.pack()
Example #23
Source File: gui_widgets.py From SVPV with MIT License | 5 votes |
def __init__(self, parent): tk.LabelFrame.__init__(self, parent) self.ref_gene_on = tk.IntVar(value=0) self.ref_gene_on_cb = tk.Checkbutton(self, text="ref gene\nintersection", justify=tk.LEFT, variable=self.ref_gene_on) self.ref_gene_on_cb.grid(row=0, column=0, sticky=tk.W) self.gene_list_on = tk.IntVar(value=0) self.gene_list_on_cb = tk.Checkbutton(self, text="gene list\nintersection", justify=tk.LEFT, variable=self.gene_list_on) self.gene_list_on_cb.grid(row=1, column=0, sticky=tk.W) self.exonic_on = tk.IntVar(value=0) self.exonic_on_cb = tk.Checkbutton(self, text="exonic", justify=tk.LEFT, variable=self.exonic_on) self.exonic_on_cb.grid(row=2, column=0, sticky=tk.W)
Example #24
Source File: backend_tkagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _Button(self, text, file, command, extension='.ppm'): img_file = os.path.join(rcParams['datapath'], 'images', file + extension) im = Tk.PhotoImage(master=self, file=img_file) b = Tk.Button( master=self, text=text, padx=2, pady=2, image=im, command=command) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #25
Source File: backend_tkagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _Button(self, text, file, command): file = os.path.join(rcParams['datapath'], 'images', file) im = Tk.PhotoImage(master=self, file=file) b = Tk.Button( master=self, text=text, padx=2, pady=2, image=im, command=command) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #26
Source File: CallTipWindow.py From oss-ftp with MIT License | 5 votes |
def showtip(self, text, parenleft, parenright): """Show the calltip, bind events which will close it and reposition it. """ # Only called in CallTips, where lines are truncated self.text = text if self.tipwindow or not self.text: return self.widget.mark_set(MARK_RIGHT, parenright) self.parenline, self.parencol = map( int, self.widget.index(parenleft).split(".")) self.tipwindow = tw = Toplevel(self.widget) self.position_window() # remove border on calltip window tw.wm_overrideredirect(1) try: # This command is only needed and available on Tk >= 8.4.0 for OSX # Without it, call tips intrude on the typing process by grabbing # the focus. tw.tk.call("::tk::unsupported::MacWindowStyle", "style", tw._w, "help", "noActivates") except TclError: pass self.label = Label(tw, text=self.text, justify=LEFT, background="#ffffe0", relief=SOLID, borderwidth=1, font = self.widget['font']) self.label.pack() self.checkhideid = self.widget.bind(CHECKHIDE_VIRTUAL_EVENT_NAME, self.checkhide_event) for seq in CHECKHIDE_SEQUENCES: self.widget.event_add(CHECKHIDE_VIRTUAL_EVENT_NAME, seq) self.widget.after(CHECKHIDE_TIME, self.checkhide_event) self.hideid = self.widget.bind(HIDE_VIRTUAL_EVENT_NAME, self.hide_event) for seq in HIDE_SEQUENCES: self.widget.event_add(HIDE_VIRTUAL_EVENT_NAME, seq)
Example #27
Source File: backend_tkagg.py From Computable with MIT License | 5 votes |
def _Button(self, text, file, command, extension='.ppm'): img_file = os.path.join(rcParams['datapath'], 'images', file + extension) im = Tk.PhotoImage(master=self, file=img_file) b = Tk.Button( master=self, text=text, padx=2, pady=2, image=im, command=command) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #28
Source File: backend_tkagg.py From Computable with MIT License | 5 votes |
def _Button(self, text, file, command): file = os.path.join(rcParams['datapath'], 'images', file) im = Tk.PhotoImage(master=self, file=file) b = Tk.Button( master=self, text=text, padx=2, pady=2, image=im, command=command) b._ntimage = im b.pack(side=Tk.LEFT) return b
Example #29
Source File: menotexport-gui.py From Menotexport with GNU General Public License v3.0 | 5 votes |
def addPathFrame(self): frame=Frame(self) frame.pack(fill=tk.X,expand=0,side=tk.TOP,padx=8,pady=5) frame.columnconfigure(1,weight=1) #------------------Database file------------------ label=tk.Label(frame,text='Mendeley Data file:',\ bg='#bbb') label.grid(row=0,column=0,\ sticky=tk.W,padx=8) self.db_entry=tk.Entry(frame) self.db_entry.grid(row=0,column=1,sticky=tk.W+tk.E,padx=8) self.db_button=tk.Button(frame,text='Open',command=self.openFile) self.db_button.grid(row=0,column=2,padx=8,sticky=tk.E) hint=''' Default location on Linux: ~/.local/share/data/Mendeley\ Ltd./Mendeley\ Desktop/your_email@www.mendeley.com.sqlite Default location on Windows: C:\Users\Your_name\AppData\Local\Mendeley Ltd\Mendeley Desktop\your_email@www.mendeley.com.sqlite''' hint_label=tk.Label(frame,text=hint,\ justify=tk.LEFT,anchor=tk.NW) hint_label.grid(row=1,column=0,columnspan=3,\ sticky=tk.W,padx=8) #--------------------Output dir-------------------- label2=tk.Label(frame,text='Output folder:',\ bg='#bbb') label2.grid(row=2,column=0,\ sticky=tk.W,padx=8) self.out_entry=tk.Entry(frame) self.out_entry.grid(row=2,column=1,sticky=tk.W+tk.E,padx=8) self.out_button=tk.Button(frame,text='Choose',command=self.openDir) self.out_button.grid(row=2,column=2,padx=8,sticky=tk.E)
Example #30
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, property_dict, *args, **kw): tk.Frame.__init__(self, parent, *args, **kw) # create a canvas object and a vertical scrollbar for scrolling it self.vscrollbar = vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) vscrollbar.pack(fill=tk.Y, side=tk.RIGHT, expand=tk.FALSE) self.canvas = canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set) canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.TRUE) vscrollbar.config(command=canvas.yview) # reset the view canvas.xview_moveto(0) canvas.yview_moveto(0) # create a frame inside the canvas which will be scrolled with it self.interior = interior = tk.Frame(canvas) self.interior_id = canvas.create_window(0, 0, window=interior, anchor='nw') self.interior.bind('<Configure>', self._configure_interior) self.canvas.bind('<Configure>', self._configure_canvas) self.build(property_dict)