Python Tkinter.WORD Examples

The following are 6 code examples of Tkinter.WORD(). 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: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def cb_word_wrap(self, widget=None, data=None):
        self._text_box.configure(wrap=Tk.WORD if self._word_wrap_tkval.get() else Tk.NONE)
        self._gui_config["word_wrap"] = self._word_wrap_tkval.get() 
Example #2
Source File: asktext.py    From textext with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def word_wrap_toggled_cb(self, action, sourceview):
        sourceview.set_wrap_mode(Gtk.WrapMode.WORD if action.get_active() else Gtk.WrapMode.NONE)
        self._gui_config["word_wrap"] = action.get_active() 
Example #3
Source File: edrtogglingpanel.py    From edr with Apache License 2.0 5 votes vote down vote up
def __init__(self, status, show, parent=0):
        conf = IGMConfig(config_file='config/igm_alt_config.v3.ini', user_config_file=['config/user_igm_alt_config.v3.ini', 'config/user_igm_alt_config.v2.ini'])
        ToggledFrame.__init__(self, parent, label="EDR:", status=status, show=show)
        self.pack(fill="x", expand=1, pady=2, padx=2, anchor="n")
        self.output = tk.Text(self.sub_frame, width=conf.len("general", "body"), height=conf.body_rows("general"),
                                                background=conf.rgb("general", "fill"), foreground=conf.rgb("general", "body"),
                                                wrap=tk.WORD, padx=4, borderwidth=0)
        self.output.pack(fill="x", expand=1)

        self.__configure_tags(conf)
        self.toggle() 
Example #4
Source File: strap_beam_gui.py    From Structural-Engineering with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 #5
Source File: Tkinter_Widget_Examples.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 5 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.pack()

        tk.Label(self, text="This is a text box").pack()

        text_frame = tk.Frame(self, borderwidth=1, relief='sunken')
        text_frame.pack(padx=10, pady=10)

        self.text = tk.Text(text_frame, width=30, height=4, wrap=tk.WORD)
        self.text.pack()

        tk.Button(self, text='OK', command=self.ok).pack() 
Example #6
Source File: 06_File_Uploader.py    From MacAdmins-2016-Craft-GUIs-with-Python-and-Tkinter with MIT License 4 votes vote down vote up
def __init__(self, master):
        tk.Frame.__init__(self, master)
        self.master.title("File Upload Assistant")
        self.master.resizable(False, False)
        self.master.tk_setPalette(background='#e6e6e6')

        self.master.protocol('WM_DELETE_WINDOW', self.click_cancel)
        self.master.bind('<Escape>', self.click_cancel)

        self.grid(row=0, column=0)

        x = (self.master.winfo_screenwidth() - self.master.winfo_reqwidth()) / 2
        y = (self.master.winfo_screenheight() - self.master.winfo_reqheight()) / 3
        self.master.geometry("+{}+{}".format(x, y))

        self.master.config(menu=tk.Menu(self.master))

        self.selected_files = tuple()
        self.file_count = tk.StringVar(value='')

        file_frame = tk.Frame(self)
        file_frame.pack(padx=15, pady=(15, 0), anchor='w')

        self.file_button = tk.Button(file_frame, text='Select file(s)...', command=self.file_picker, anchor='w')
        self.file_button.pack(side='left')

        self.file_label = tk.Label(file_frame, textvariable=self.file_count, anchor='e')
        self.file_label.pack(side='right')

        tk.Label(self, text="Add a comment:").pack(padx=15, pady=(15, 0), anchor='w')

        text_frame = tk.Frame(self, borderwidth=1, relief='sunken')
        text_frame.pack(padx=15, pady=15)

        self.text = tk.Text(text_frame, width=30, height=4, highlightbackground='#ffffff', highlightcolor="#7baedc",
                            bg='#ffffff', wrap=tk.WORD, font=("System", 14))
        self.text.focus_set()
        self.text.pack()

        button_frame = tk.Frame(self)
        button_frame.pack(padx=15, pady=(0, 15), anchor='e')

        self.submit_button = tk.Button(button_frame, text='Submit', default='active', command=self.click_submit)
        self.submit_button.pack(side='right')

        self.cancel_button = tk.Button(button_frame, text='Cancel', command=self.click_cancel)
        self.cancel_button.pack(side='right')