コード例 #1
0
def FindAsk(parent, *args):
    root = Tkinter.Toplevel(parent)
    root.title("Find And Replace")
    root.transient(parent)
    root.focus_force()
    root.resizable(width=0, height=0)
    root['padx'] = 20
    fields = {}
    field = {}
    for r, label in enumerate(args):
        store_label = Tkinter.Label(root, text=label)
        store_label.grid(row=r, column=0, ipady=5, ipadx=20)
        store_entry = Tkinter.Entry(root)
        store_entry.grid(row=r, column=1)
        field[label] = store_entry
    fields['submit'] = False

    def sub():
        for l, t in field.iteritems():
            fields[l] = t.get()
        fields['submit'] = True
        root.destroy()
        return

    submit = Tkinter.Button(root, text="Ok", command=sub)
    submit.grid(row=r + 1, column=2)
    root.wait_window()
    return fields
コード例 #2
0
        for i in txtfilter.finditer(val):
            start = i.start()
            end = i.end() - 1
            #print start,end
            tagtype, color = check(k=i.groupdict())
            if color != 'NILL':
                ind1, ind2 = _coordinate(start, end, val)
                #print ind1, ind2
                self.txt.tag_add(tagtype, ind1, ind2)
                self.txt.tag_config(tagtype, foreground=color)
                #Tkinter.Text.tag_configure


#        for i in idprog.finditer(val):
#            start=i.start()
#            end=i.end()-1
#            ind1,ind2=_coordinate(start,end,val)
#            self.txt.tag_add('BLUE',ind1, ind2)
#            self.txt.tag_config("BLUE",foreground='grey')
#            #Tkinter.Text.tag_configure

if __name__ == '__main__':
    root = Tkinter.Tk()
    txt = Tkinter.Text(root)
    txt.pack(expand='yes')
    txt.storeobj = {}
    store = ColorLight(txtbox=txt)
    Tkinter.Button(root, text='Click me',
                   command=lambda: store.trigger()).pack()
    root.mainloop()
コード例 #3
0
        return

    def ShowInfo(self, event=None):
        if not self.window:
            self.window = Tkinter.Toplevel()
            self.window.overrideredirect(True)
            WIDTH = self.width or len(self.text) * 10
            HEIGHT = self.height or (len(self.text.split('\n')) + 1) * 10
            self.window.geometry(
                "%dx%d+%d+%d" %
                (WIDTH, HEIGHT, event.x_root + 10, event.y_root + 10))
            Label = Tkinter.Label(self.window,
                                  text=self.text,
                                  font=("arial 10 bold"),
                                  fg='white',
                                  bg='black')
            Label.pack(expand=True, fill='both')
            self.window.wait_visibility(self.window)
            self.window.attributes('-alpha', 0.7)
            t = Thread(target=self.AutoHide)
            t.start()
        return


if __name__ == '__main__':
    root = Tkinter.Tk()
    Button = Tkinter.Button(root, text="Point Mouse Here")
    Button.pack(padx=20, pady=20)
    Banner(Button, """Testing Windows""")
    root.mainloop()