예제 #1
0
def main():
    top = tix.Tk()

    nb = tix.NoteBook(top, width=300, height=200)
    nb.pack(expand=True, fill="both")

    nb.add("page1", label="text")
    f1 = tix.Frame(nb.subwidget("page1"))
    st = tix.ScrolledText(f1)
    st.subwidget("text").insert("1.0", "Here is where the text goes...")
    st.pack(expand=True)
    f1.pack()

    nb.add("page2", label="Message Boxes")
    f2 = tix.Frame(nb.subwidget("page2"))
    # 通过联合使用expand,fill和anchor,在窗口大小改变时,可以精确地控制小部件的行为
    tix.Button(
        f2,
        text="error",
        bg="lightblue",
        command=lambda t="error", m="This is bad!": mb.showerror(t, m)).pack(
            fill="x", expand=True)
    tix.Button(
        f2,
        text="info",
        bg="pink",
        command=lambda t="info", m="Information": mb.showinfo(t, m)).pack(
            fill="x", expand=True)
    tix.Button(f2,
               text="warning",
               bg="yellow",
               command=lambda t="warning", m="Don't do it!": mb.showwarning(
                   t, m)).pack(fill="x", expand=True)
    tix.Button(
        f2,
        text="question",
        bg="green",
        command=lambda t="question", m="Will I?": mb.askquestion(t, m)).pack(
            fill="x", expand=True)
    tix.Button(f2,
               text="yes - no",
               bg="lightgrey",
               command=lambda t="yes - no", m="Are you sure?": mb.askyesno(
                   t, m)).pack(fill="x", expand=True)
    tix.Button(f2,
               text="yes - no - cancel",
               bg="black",
               fg="white",
               command=lambda t="yes - not - cancel", m="Last chance...": mb.
               askyesnocancel(t, m)).pack(fill="x", expand=True)

    f2.pack(side="top", fill="x")
    top.mainloop()
예제 #2
0
 def about_license_clicked(self):
     about = tix.Toplevel()  # bg="#0f0" does not work
     about.title("License")
     about.resizable(width=False, height=False)
     set_window_icon(about)
     about.bind('<Escape>', lambda e: about.destroy())
     ###
     msg1 = tix.Message(
         about,
         width=420,
         text=licenseText,
         font=("DejaVu Sans", 9, "bold"),
     )
     msg1.pack(fill="x", expand=True)
     ###########
     frame = tix.Frame(about)
     closeB = ttk.Button(
         frame,
         text="Close",
         command=about.destroy,
         # bg="#ff0000",
         # activebackground="#ff5050",
     )
     closeB.pack(side="right")
     frame.pack(fill="x")
예제 #3
0
    def __init__(self, w, aLogic):
        self.logic = aLogic
        self.currentSequent = ''
        self.currentProof = Proof()
        self.sequentEntry = None
        self.proofBox = None
        self.ruleBox = None

        self.selectSet = []  # The list of items currently selected

        self.root = w
        self.exit = -1

        z = w.winfo_toplevel()
        z.wm_protocol("WM_DELETE_WINDOW", lambda self=self: self.quit())

        w.title("Proof Builder")
        top = tix.Frame(w, relief=tix.RAISED, bd=1)

        self.sequentEntryBox(top)
        self.workAreaBox(top)
        self.buttonBox(top)

        top.pack(fill=tix.BOTH, expand=1, padx=10, pady=10)

        self.updateProof()
예제 #4
0
    def __init__(self, parent, opts, title = None):

        tix.Toplevel.__init__(self, parent)
        self.transient(parent)

        if title:
            self.title(title)

        self.parent = parent

        self.result = None

        self.initial_focus = None
        self.bodyframe = matdb_frame.MatDBFrame(self, opts)

        self.bodyframe.grid(row=0, column=0, sticky=tix.N+tix.S+tix.E+tix.W)

        self.buttonframe = tix.Frame(self)
        self.buttonbox(self.buttonframe)
        self.buttonframe.grid(row=1, column=0, sticky=tix.N+tix.S)

        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)

        self.geometry("+%d+%d" % (parent.winfo_rootx()+50,
                                  parent.winfo_rooty()+50))

        self.rowconfigure(0,weight=1)
        self.columnconfigure(0,weight=1)

        self.initial_focus.focus_set()
예제 #5
0
    def __init__(self, format, kind, values, master=None):
        tix.Toplevel.__init__(self)
        # bg="#0f0" does not work
        self.resizable(width=True, height=True)
        self.title(kind + " Options")
        set_window_icon(self)
        self.bind('<Escape>', lambda e: self.destroy())

        self.menu = None
        self.format = format
        self.kind = kind
        self.values = values
        self.options = list(self.kindFormatsOptions[kind][format].keys())
        self.optionsProp = Glossary.plugins[format].optionsProp

        self.createOptionsList()

        buttonBox = tix.Frame(self)
        okButton = newTTKButton(
            buttonBox,
            text="OK",
            command=self.okClicked,
            # bg="#ff0000",
            # activebackground="#ff5050",
        )
        okButton.pack(side="right")
        buttonBox.pack(fill="x")
예제 #6
0
def RunTree(w, filename):
    top = tkinter_tix.Frame(w, relief=tkinter_tix.RAISED, bd=1)
    tree = tkinter_tix.Tree(top, options="hlist.columns 2")
    tree.pack(expand=1,
              fill=tkinter_tix.BOTH,
              padx=10,
              pady=10,
              side=tkinter_tix.LEFT)
    # print(tree.hlist.keys())   # use to see the available configure() options
    tree.hlist.configure(bg='white', font='Courier 10', indent=30)
    tree.hlist.configure(selectbackground='light yellow', gap=150)

    box = tkinter_tix.ButtonBox(w, orientation=tkinter_tix.HORIZONTAL)
    # box.add('ok', text='Ok', underline=0, command=w.destroy, width=6)
    box.add('exit', text='Exit', underline=0, command=w.destroy, width=6)
    box.pack(side=tkinter_tix.BOTTOM, fill=tkinter_tix.X)
    top.pack(side=tkinter_tix.TOP, fill=tkinter_tix.BOTH, expand=1)
    # https://stackoverflow.com/questions/17355902/python-tkinter-binding-mousewheel-to-scrollbar
    tree.bind_all(
        '<MouseWheel>',
        lambda event:  # Wheel in Windows
        tree.hlist.yview_scroll(int(-1 * event.delta / 120.), "units"))
    tree.bind_all(
        '<Button-4>',
        lambda event:  # Wheel up in Linux
        tree.hlist.yview_scroll(int(-1), "units"))
    tree.bind_all(
        '<Button-5>',
        lambda event:  # Wheel down in Linux
        tree.hlist.yview_scroll(int(+1), "units"))

    show_file(filename, tree)
예제 #7
0
파일: text.py 프로젝트: gitter-badger/TkPy2
def text_view(view_text: str,
              title='TkPy text view',
              geometry=None,
              min_size=None,
              max_size=None,
              base_root=None):
    def Copy():
        copy_text = text.get(tk.SEL_FIRST, tk.SEL_LAST) or text.get(
            0.0, tk.END)
        pyperclip.copy(copy_text)

    root = tk.Toplevel(base_root)
    root.transient(base_root)
    root.title(title)
    root.resizable(0, 0)
    if geometry is not None:
        root.geometry(geometry)
    if min_size:
        root.minsize(*min_size)
    if max_size:
        root.maxsize(max_size)
    text = tk.Text(root)
    ycrollbar = tk.Scrollbar(root)
    Frame = tk.Frame(root)
    CopyButton = ttk.Button(Frame, text='复制', command=Copy)
    CloseButton = ttk.Button(Frame, text='关闭', command=root.destroy)
    text.insert(tk.END, view_text)
    CopyButton.pack(fill=tk.X, expand=True, side=tk.RIGHT)
    CloseButton.pack(fill=tk.X, expand=True, side=tk.LEFT)
    ycrollbar.config(command=text.yview)
    Frame.pack(side=tk.BOTTOM, fill=tk.X, expand=True)
    ycrollbar.pack(side=tk.RIGHT, fill=tk.Y)
    text.pack(fill=tk.BOTH, expand=True)
    text.config(yscrollcommand=ycrollbar.set, state=tk.DISABLED)
    root.mainloop()
예제 #8
0
    def valueMenuItemCustomSelected(self, treev, format, optName, menu=None):
        if menu:
            menu.destroy()
            self.menu = None

        value = treev.set(optName, self.valueCol)

        dialog = tix.Toplevel(master=treev)  # bg="#0f0" does not work
        dialog.resizable(width=True, height=True)
        dialog.title(optName)
        set_window_icon(dialog)
        dialog.bind('<Escape>', lambda e: dialog.destroy())

        px, py, pw, ph = decodeGeometry(treev.winfo_toplevel().geometry())
        w = 300
        h = 100
        dialog.geometry(
            encodeGeometry(
                px + pw // 2 - w // 2,
                py + ph // 2 - h // 2,
                w,
                h,
            ))

        frame = tix.Frame(master=dialog)

        label = ttk.Label(master=frame, text="Value for " + optName)
        label.pack()

        entry = ttk.Entry(master=frame)
        entry.insert(0, value)
        entry.pack(fill="x")

        def okClicked(event=None):
            value = entry.get()
            treev.set(optName, self.valueCol, value)
            treev.set(optName, "#1", "1")  # enable it
            col_w = tkFont.Font().measure(value)
            if treev.column("Value", width=None) < col_w:
                treev.column("Value", width=col_w)
            dialog.destroy()

        entry.bind("<Return>", okClicked)

        label = ttk.Label(master=frame)
        label.pack(fill="x")

        button = ttk.Button(
            frame,
            text="Ok",
            command=okClicked,
            # bg="#ff0000",
            # activebackground="#ff5050",
        )
        button.pack(side="right")
        ###
        frame.pack(fill="x")
        dialog.focus()
예제 #9
0
파일: sudogui.py 프로젝트: df92/sudosimu
 def _drawUI(self, frame):
     '''Dessine les widgets d'interface dans la frame indiquée.'''
     #canvas et dessin de la grille
     self._fgrid = tix.Frame(frame, bg="white")
     self._cnv = tix.Canvas(self._fgrid, width=280, height=280, bg="white")
     self._grid = SudoGuiGrid(self._cnv)
     #la grille est en haut de sa frame et de taille fixe
     self._cnv.pack(side="top")
     #texte déroulant
     self._ftext = tix.Frame(frame, bg="white")
     self._st = tix.ScrolledText(self._ftext, width=500, height=600)
     self._disp = self._st.subwidget("text")
     #la textbox est en haut de sa frame et la remplit
     self._st.pack(side="top", fill="both", expand=True)
     #arrangement des frames
     self._fgrid.pack(side="left", fill="y")
     self._ftext.pack(side="right", fill="both", expand=True)
     return
 def body(self, top):
     ''' define GUI elements'''
     f = tix.Frame(top)
     f.pack(expand=True, fill='x')
     for row, opt in enumerate(self.options):
         tix.Label(f, text=opt[0]).grid(row=row, column=0, sticky='w')
         e = tix.Entry(f)
         e.grid(row=row, column=1, sticky='e')
         e.insert('end', str(opt[1]))
         self.entries.append(e)
예제 #11
0
    def build_notebook(self, top):
        mono_font = self.get_mono_font()
        nb = tix.NoteBook(top)

        nb.add("item_page",
               label="items",
               raisecmd=lambda pg="item": self.ev_page(pg))
        fr = tix.Frame(nb.subwidget("item_page"))
        self.item_fmt = "{:15} {:15} {:10} ${:<8} {:12}"
        tix.Label(fr,
                  font=mono_font,
                  text=self.item_fmt.format("Name", "Description", "Owner",
                                            "Price",
                                            "Condition")).pack(anchor="w")
        # 使用tix.ScrolledListBox而不是tix.ScrolledText小部件。使用ScrolledListBox小部件可以更加容易地选择行。
        slb = tix.ScrolledListBox(fr, width=500, height=200)
        slb.pack(fill="both", expand=True)
        fr.pack(fill="both", expand=True)
        self.item_list = slb.subwidget("listbox")
        self.item_list.configure(font=mono_font, bg="white")
        # 使用bind()方法将鼠标左键双击链接到适当的编辑事件处理程序上。除了处理默认小部件的命令,bind()机制可以处理任意事件。
        # 不同的是,回调函数必须接受一个事件参数并为参数设置了默认值None。这样普通的回调机制以及双击链接也可以使用它
        self.item_list.bind("<Double-1>", self.ev_edit_item)

        # 事件处理程序都是自解释型的。在选中新的notebook页时,就会触发ev_page()处理程序。它只是为活动页面启动对应的菜单。
        nb.add("member_page",
               label="members",
               raisecmd=lambda pg="member": self.ev_page(pg))
        fr = tix.Frame(nb.subwidget("member_page"))
        self.member_fmt = "{:<15} {:<40}"
        tix.Label(fr,
                  font=mono_font,
                  text=self.member_fmt.format(
                      "Name", "Email Address")).pack(anchor="w")
        slb = tix.ScrolledListBox(fr, width=40, height=20)
        slb.pack(fill="both", expand=True)
        fr.pack(fill="both", expand=True)
        self.member_list = slb.subwidget("listbox")
        self.member_list.configure(font=mono_font, bg="white")
        self.member_list.bind("<Double-1>", self.ev_edit_member)

        return nb
예제 #12
0
    def __init__(self):
        self.root = tk.Tk()
        self.root.geometry('700x700')

        self.scrollbar = tk.ScrolledWindow(self.root, scrollbar=tk.BOTH)
        self.scrollbar.pack(fill=tk.BOTH, expand=1)

        self.top_frame = tk.Frame(self.scrollbar.window)
        self.top_frame.pack(side=tk.TOP)

        self.bottom_frame = tk.Frame(self.scrollbar.window)
        self.bottom_frame.pack(side=tk.BOTTOM)

        self.forward = tk.Button(self.bottom_frame, text='далее')
        self.forward.pack(side=tk.LEFT)
        self.forward.bind('<1>', self.click_forward)
        self.forward.pos = ''

        self.path = tk.Label(self.bottom_frame, text='')
        self.path.pack(side=tk.LEFT)
예제 #13
0
    def buildNoteBook(self, top):
        mono_font = self.getMonoFont()
        nb = tix.NoteBook(top)

        nb.add("itemPage",
               label="Items",
               raisecmd=lambda pg="item": self.evPage(pg))
        fr = tix.Frame(nb.subwidget("itemPage"))
        self.itemFmt = "{:15} {:15} {:10} ${:<8} {:12}"
        tix.Label(fr,
                  font=mono_font,
                  text=self.itemFmt.format("Name", "Description", "Owner",
                                           "Price",
                                           "Condition")).pack(anchor='w')
        slb = tix.ScrolledListBox(fr, width=500, height=200)
        slb.pack(fill='both', expand=True)
        fr.pack(fill='both', expand=True)
        self.itemList = slb.subwidget("listbox")
        self.itemList.configure(font=mono_font, bg='white')
        self.itemList.bind('<Double-1>', self.evEditItem)

        nb.add("memberPage",
               label="Members",
               raisecmd=lambda pg="member": self.evPage(pg))
        fr = tix.Frame(nb.subwidget("memberPage"))
        self.memberFmt = "{:<15} {:<40}"
        tix.Label(fr,
                  font=mono_font,
                  text=self.memberFmt.format("Name",
                                             "Email Address")).pack(anchor='w')
        slb = tix.ScrolledListBox(fr, width=40, height=20)
        slb.pack(fill='both', expand=True)
        fr.pack(fill='both', expand=True)
        self.memberList = slb.subwidget("listbox")
        self.memberList.configure(font=mono_font, bg='white')
        self.memberList.bind('<Double-1>', self.evEditMember)

        return nb
예제 #14
0
파일: sudogui.py 프로젝트: df92/sudosimu
 def _openGUI(self):
     '''Ouvre une fenêtre graphique.
     Dans cette version ce n'est pas réellement une application Python, la
     fenêtre ne fonctionne qu'à travers un shell Python (ex: IDLE). Il n'y
     a pas d'appel de mainloop().
     '''
     #fenêtre graphique et top frame
     self._gui = tix.Tk()
     self._gui.title("HumaSudo - Sudoku humain")
     self._ftop = tix.Frame(self._gui, bg="white")
     self._ftop.pack(fill="both", expand=True)
     #construction de l'interface dans la top frame
     self._drawUI(self._ftop)
     return
예제 #15
0
    def sequentEntryBox(self, parent):
        seqFrame = tix.Frame(parent)

        label = tix.Label(seqFrame, text='Sequent')
        label.grid(row=0, column=0, padx=5, pady=5)

        self.sequentEntry = tix.Entry(seqFrame, width=100)
        self.sequentEntry.grid(row=0, column=1, padx=5, pady=5)

        self.proveBtn = tix.Button(seqFrame,
                                   text='Prove',
                                   command=self.onProveButton)
        self.proveBtn.grid(row=0, column=2, padx=5, pady=5)

        seqFrame.pack(fill=tix.X, ipadx=5, padx=40, pady=15)
예제 #16
0
 def _startGUI(self):
     '''Ouvre une fenêtre graphique.
     Dans cette version ce n'est pas réellement une application Python, la
     fenêtre ne fonctionne qu'à travers un shell Python (ex: IDLE)
     '''
     global mode
     global GUI
     self.__gui = tix.Tk()
     self.__gui.title("HumaSudo - Sudoku humain")
     self.__ftop = tix.Frame(self.__gui)
     self.__st = tix.ScrolledText(self.__ftop, width=300, height=500)
     self.__st.pack(side="top", fill="both")
     self.__ftop.pack(side="top", fill="both")
     self.__disp = self.__st.subwidget("text")
     return
예제 #17
0
 def __init__(self, base_root=None):
     self.root = tk.Toplevel(base_root)
     self.root.transient(base_root)
     self.root.minsize(400, 50)
     self.root.resizable(0, 0)
     self.all_file_types = [('图片文件', ('.png', '.jpg', '.jpeg'))]
     self.root.title('文字识别')
     self.Frame = tk.Frame(self.root)
     self.scrollbar = tk.Scrollbar(self.root, orient=tk.HORIZONTAL)
     self.LabelFrame = ttk.LabelFrame(self.root, text='文件目录: ')
     self.Entry = ttk.Entry(self.LabelFrame,
                            xscrollcommand=self.scrollbar.set)
     self.scrollbar.config(command=self.Entry.xview)
     self.Entry.config(state=tk.DISABLED)
     self.Button = ttk.Button(self.Frame, text='选择文件', command=self.askfile)
     self.submmitButton = ttk.Button(
         self.Frame, text='识别', command=lambda: self.ok(self.Entry.get()))
예제 #18
0
    def __init__(self, parent, entries=None, title=None):
        tix.Frame.__init__(self, parent, title)

        self.entries = entries
        self.pathmap = {} # (path in listbox) -> (element of entries)
        
        self.pwindow = tix.PanedWindow(self, orientation='horizontal')

        self.p1 = self.pwindow.add('p1', at=0, expand=0)
        self.p2 = self.pwindow.add('p2', at=1, expand=1)

        # create scrolled listbox
        listframe = tix.Frame(self.p1, bd=2, relief=tix.SUNKEN)

        self.listbox = tix.Tree(listframe, browsecmd=self._browsecommand)
        self.listbox.hlist.config(width=40)
        self.listbox.pack(expand=True, fill=tix.BOTH)

        # self.listbox.insert(tix.END, *[a['name'] for a in self.entries])
        # self.listbox.bind('<<ListboxSelect>>', self._lbselect)

        listframe.grid_rowconfigure(0, weight=1)
        listframe.grid_columnconfigure(0, weight=1)

        listframe.grid(row=0, column=0, padx=(0,5), sticky=tix.N+tix.S+tix.E+tix.W)
        self.p1.rowconfigure(0,weight=1)
        self.p1.columnconfigure(0,weight=1)

        # for some version of tix, auto option does not work but acts like 'both'
        self.summary = tix.ScrolledText(self.p2, bd=2, scrollbar='auto', relief=tix.SUNKEN)

        self.summary.text.config(width=80)
        self.summary.text.config(wrap=tix.NONE)

        self.summary.grid(row=0, column=0, padx=(5,0), sticky=tix.N+tix.S+tix.E+tix.W)
        self.p2.rowconfigure(0,weight=1)
        self.p2.columnconfigure(0,weight=1)

        self.pwindow.grid(row=0, column=0, sticky=tix.N+tix.S+tix.E+tix.W)
        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.set_listbox_entries(self.entries)
예제 #19
0
    def __init__(self, master, srimdata=None, title=None):
        """
        @param master master widget
        @param srimdata path to SRIM compound db, usually encoded in cp437
        @param title title of the widget
        """
        tix.Toplevel.__init__(self, master)
        self.transient(master)

        if title:
            self.title(title)

        self.master = master

        self.result = None

        self.initial_focus = None
        self.bodyframe = srim_matdb_frame.SRIMMatDBFrame(self, srimdata)

        self.bodyframe.grid(row=0,
                            column=0,
                            sticky=tix.N + tix.S + tix.E + tix.W)

        self.buttonframe = tix.Frame(self)
        self.buttonbox(self.buttonframe)
        self.buttonframe.grid(row=1, column=0, sticky=tix.N + tix.S)

        self.grab_set()

        if not self.initial_focus:
            self.initial_focus = self

        self.protocol("WM_DELETE_WINDOW", self.cancel)

        self.geometry("+%d+%d" %
                      (master.winfo_rootx() + 50, master.winfo_rooty() + 50))

        self.rowconfigure(0, weight=1)
        self.columnconfigure(0, weight=1)

        self.initial_focus.focus_set()
예제 #20
0
파일: app.py 프로젝트: GdonatasG/egz
    def __init__(self, *args, **kwargs):
        tkx.Tk.__init__(self, *args, *kwargs)
        container = tkx.Frame()

        # Frames/langų dictionary
        self._frames = {}

        # Šiuo metu aplikacijoje esantis langas
        self._selected = None
        container.pack(side="top", fill="both", expand=True)
        self.minsize(Constants.MIN_WIDTH, Constants.MIN_HEIGHT)

        self.container = container

        # Programoje egzistuojantys langai
        self._frames[Constants.WINDOW_HOME] = Home(parent=container,
                                                   controller=self)
        self._frames[Constants.WINDOW_GRAPHIC] = Graphic(parent=container,
                                                         controller=self)

        # Pradinis aplikacijos langas
        self.switch_frame(Constants.WINDOW_HOME)
예제 #21
0
    def __init__(self,
                 parent,
                 language="Python",
                 font=("Courier", "10"),
                 numbersWidth=30,
                 *args,
                 **kwargs):
        '''Initialize CodePack instance'''
        tkinter.Frame.__init__(self, parent)

        self.text = ChangeText(self,
                               font=("Courier", 13),
                               wrap="word",
                               spacing3="2",
                               bd=0,
                               undo=True,
                               background="white",
                               *args,
                               **kwargs)
        self.text.pack(side=tkinter.RIGHT, expand=True, fill="both")
        self.text.bind("<<Change>>", self._changed)
        self.text.bind("<Control-KeyRelease-a>", self._highlightLine)

        self.lineNumbersFrame = tkinter.Frame(self)
        self.lineNumbersFrame.pack(side=tkinter.LEFT, fill="y")

        self.lineNumbers = tkinter.Canvas(self.lineNumbersFrame, width=30)
        self.lineNumbers.pack(expand=True, fill="y")

        self.font = font
        self.language = language

        self.p = Percolator(self.text)
        self.d = ColorDelegator(language=self.language, bg="white")
        self.p.insertfilter(self.d)

        self.text.tag_config("Current Line", background="cornsilk")
        self._setLanguageBindings()
예제 #22
0
    def __init__(self, master, proc_fn):
        self.master = master
        self.frame = tix.Frame(master)
        self.frame.width = 150
        self.frame.rowconfigure(0, minsize=15)
        self.frame.rowconfigure(3, minsize=15)
        self.frame.rowconfigure(5, minsize=15)
        self.frame.rowconfigure(7, minsize=15)
        self.frame.columnconfigure(0, minsize=15)
        self.frame.columnconfigure(4, minsize=15)
        self.frame.pack()

        tix.Label(self.frame, text="Archivo de Entrada :").grid(row=2,
                                                                sticky=tix.W)
        tix.Label(self.frame, text="Archivo de Salida  :").grid(row=4,
                                                                sticky=tix.W)

        self.input = tix.Entry(self.frame)
        self.input.grid(row=2, column=3)
        tix.Button(self.frame, text="...",
                   command=self.get_input).grid(row=2, column=2)
        self.output = tix.Entry(self.frame)
        self.output.grid(row=4, column=3)
        tix.Button(self.frame, text="...",
                   command=self.set_output).grid(row=4, column=2)

        tix.Button(self.frame, text="Cancelar",
                   command=self.frame.quit).grid(row=6, column=1)
        tix.Button(self.frame, text="Procesar", command=proc_fn).grid(row=6,
                                                                      column=3)

        self.box = None
        self.in_out_state = None
        self.ready = False
        self.in_file = None
        self.out_file = None
예제 #23
0
파일: ui_tk.py 프로젝트: numb95/pyglossary
 def about_license_clicked(self):
     about = tix.Toplevel()  ## bg='#0f0' does not work
     about.title('License')
     about.resizable(False, False)
     about.wm_iconbitmap('@%s' % xbmLogo)
     ###
     msg1 = tix.Message(
         about,
         width=420,
         text=licenseText,
         font=('DejaVu Sans', 9, 'bold'),
     )
     msg1.pack(fill='x', expand=True)
     ###########
     frame = tix.Frame(about)
     closeB = tix.Button(
         frame,
         text='Close',
         command=about.destroy,
         #bg='#ff0000',
         #activebackground='#ff5050',
     )
     closeB.pack(side='right')
     frame.pack(fill='x')
예제 #24
0
 def about_credits_clicked(self):
     about = tix.Toplevel()  ## bg='#0f0' does not work
     about.title('Credits')
     about.resizable(False, False)
     set_window_icon(about)
     ###
     msg1 = tix.Message(
         about,
         width=500,
         text='\n'.join(authors),
         font=('DejaVu Sans', 9, 'bold'),
     )
     msg1.pack(fill='x', expand=True)
     ###########
     frame = tix.Frame(about)
     closeB = tix.Button(
         frame,
         text='Close',
         command=about.destroy,
         #bg='#ff0000',
         #activebackground='#ff5050',
     )
     closeB.pack(side='right')
     frame.pack(fill='x')
예제 #25
0
 def about_credits_clicked(self):
     about = tix.Toplevel()  # bg="#0f0" does not work
     about.title("Credits")
     about.resizable(False, False)
     set_window_icon(about)
     ###
     msg1 = tix.Message(
         about,
         width=500,
         text="\n".join(authors),
         font=("DejaVu Sans", 9, "bold"),
     )
     msg1.pack(fill="x", expand=True)
     ###########
     frame = tix.Frame(about)
     closeB = tix.Button(
         frame,
         text="Close",
         command=about.destroy,
         # bg="#ff0000",
         # activebackground="#ff5050",
     )
     closeB.pack(side="right")
     frame.pack(fill="x")
예제 #26
0
#Source Code for Desktop Applications with Python Course by TigerStyle Code Academy 

import tkinter.tix as tk

# create the event handler to clear the text
def evClear():
  txt = stHistory.subwidget('text')
  txt.insert('end',eHello.get()+'\n')
  eHello.delete(0, 'end')

# create the top level window/frame
top = tk.Tk()
F = tk.Frame(top)
F.pack(fill="both")

# Now the frame with text entry
fEntry = tk.Frame(F, border=1)
eHello = tk.Entry(fEntry)
eHello.pack(side="left")
stHistory = tk.ScrolledText(fEntry, width=150, height=55)
stHistory.pack(side="bottom", fill="x")
fEntry.pack(side="top")

# Finally the frame with the buttons. 
# We'll sink this one for emphasis
fButtons = tk.Frame(F, relief="sunken", border=1)
bClear = tk.Button(fButtons, text="Clear Text", command=evClear)
bClear.pack(side="left", padx=5, pady=2)
bQuit = tk.Button(fButtons, text="Quit", command=F.quit)
bQuit.pack(side="left", padx=5, pady=2)
fButtons.pack(side="top", fill="x")
예제 #27
0
 def __init__(self, path="", **options):
     self.glos = Glossary(ui=self)
     self.pref = {}
     self.pref_load(**options)
     #############################################
     rootWin = self.rootWin = tix.Tk()
     tix.Frame.__init__(self, rootWin)
     rootWin.title("PyGlossary (Tkinter)")
     rootWin.resizable(True, False)
     ########
     set_window_icon(rootWin)
     ########
     self.pack(fill="x")
     # rootWin.bind("<Configure>", self.resized)
     ######################
     self.glos = Glossary(ui=self)
     self.pref = {}
     self.pref_load()
     self.pathI = ""
     self.pathO = ""
     self.fcd_dir = join(homeDir, "Desktop")
     ######################
     vpaned = tk.PanedWindow(self, orient=tk.VERTICAL)
     notebook = tix.NoteBook(vpaned)
     notebook.add("tab1", label="Convert", underline=0)
     notebook.add("tab2", label="Reverse", underline=0)
     convertFrame = tix.Frame(notebook.tab1)
     ######################
     frame = tix.Frame(convertFrame)
     ##
     label = tix.Label(frame, text="Read from format")
     label.pack(side="left")
     ##
     comboVar = tk.StringVar()
     combo = tk.OptionMenu(frame, comboVar, *Glossary.readDesc)
     # comboVar.set(Glossary.readDesc[0])
     comboVar.set(noneItem)
     combo.pack(side="left")
     self.combobox_i = comboVar
     ##
     frame.pack(fill="x")
     ###################
     frame = tix.Frame(convertFrame)
     ##
     label = tix.Label(frame, text="  Path:")
     label.pack(side="left")
     ##
     entry = tix.Entry(frame)
     entry.pack(side="left", fill="x", expand=True)
     entry.bind_all("<KeyPress>", self.entry_changed)
     self.entry_i = entry
     ##
     button = tix.Button(
         frame,
         text="Browse",
         command=self.browse_i,
         # bg="#f0f000",
         # activebackground="#f6f622",
     )
     button.pack(side="left")
     ##
     frame.pack(fill="x")
     ######################
     frame = tix.Frame(convertFrame)
     ##
     label = tix.Label(frame, text="Write to format    ")
     label.pack(side="left")
     ##
     comboVar = tk.StringVar()
     combo = tk.OptionMenu(frame, comboVar, *Glossary.writeDesc)
     # comboVar.set(Glossary.writeDesc[0])
     comboVar.set(noneItem)
     combo.pack(side="left")
     combo.bind("<Configure>", self.combobox_o_changed)
     self.combobox_o = comboVar
     ##
     frame.pack(fill="x")
     ###################
     frame = tix.Frame(convertFrame)
     ##
     label = tix.Label(frame, text="  Path:")
     label.pack(side="left")
     ##
     entry = tix.Entry(frame)
     entry.pack(side="left", fill="x", expand=True)
     # entry.bind_all("<KeyPress>", self.entry_changed)
     self.entry_o = entry
     ##
     button = tix.Button(
         frame,
         text="Browse",
         command=self.browse_o,
         # bg="#f0f000",
         # activebackground="#f6f622",
     )
     button.pack(side="left")
     ##
     frame.pack(fill="x")
     #######
     frame = tix.Frame(convertFrame)
     label = tix.Label(frame, text=" " * 15)
     label.pack(
         side="left",
         fill="x",
         expand=True,
     )
     button = tix.Button(
         frame,
         text="Convert",
         command=self.convert,
         # bg="#00e000",
         # activebackground="#22f022",
     )
     button.pack(
         side="left",
         fill="x",
         expand=True,
     )
     ###
     frame.pack(fill="x")
     ######
     convertFrame.pack(fill="x")
     vpaned.add(notebook)
     #################
     console = tix.Text(vpaned, height=15, background="#000000")
     # self.consoleH = 15
     # sbar = Tix.Scrollbar(
     #	vpaned,
     #	orien=Tix.VERTICAL,
     #	command=console.yview
     # )
     # sbar.grid ( row=0, column=1)
     # console["yscrollcommand"] = sbar.set
     # console.grid()
     console.pack(fill="both", expand=True)
     log.addHandler(TkTextLogHandler(console), )
     console.insert("end", "Console:\n")
     ####
     vpaned.add(console)
     vpaned.pack(fill="both", expand=True)
     self.console = console
     ##################
     frame2 = tix.Frame(self)
     clearB = tix.Button(
         frame2,
         text="Clear",
         command=self.console_clear,
         # bg="black",
         # fg="#ffff00",
         # activebackground="#333333",
         # activeforeground="#ffff00",
     )
     clearB.pack(side="left")
     ####
     label = tix.Label(frame2, text="Verbosity")
     label.pack(side="left")
     ##
     comboVar = tk.StringVar()
     combo = tk.OptionMenu(
         frame2,
         comboVar,
         0,
         1,
         2,
         3,
         4,
     )
     comboVar.set(log.getVerbosity())
     comboVar.trace("w", self.verbosityChanged)
     combo.pack(side="left")
     self.verbosityCombo = comboVar
     #####
     pbar = ProgressBar(frame2, width=400)
     pbar.pack(side="left", fill="x", expand=True)
     self.pbar = pbar
     frame2.pack(fill="x")
     self.progressTitle = ""
     #############
     # vpaned.grid()
     # bottomFrame.grid()
     # self.grid()
     #####################
     # lbox = Tix.Listbox(convertFrame)
     # lbox.insert(0, "aaaaaaaa", "bbbbbbbbbbbbbbbbbbbb")
     # lbox.pack(fill="x")
     ##############
     frame3 = tix.Frame(self)
     aboutB = tix.Button(
         frame3,
         text="About",
         command=self.about_clicked,
         # bg="#e000e0",
         # activebackground="#f030f0",
     )
     aboutB.pack(side="right")
     closeB = tix.Button(
         frame3,
         text="Close",
         command=self.quit,
         # bg="#ff0000",
         # activebackground="#ff5050",
     )
     closeB.pack(side="right")
     frame3.pack(fill="x")
     # __________________________ Reverse Tab __________________________ #
     revFrame = tix.Frame(notebook.tab2)
     revFrame.pack(fill="x")
     ######################
     frame = tix.Frame(revFrame)
     ##
     label = tix.Label(frame, text="Read from format")
     label.pack(side="left")
     ##
     comboVar = tk.StringVar()
     combo = tk.OptionMenu(frame, comboVar, *Glossary.readDesc)
     # comboVar.set(Glossary.readDesc[0])
     comboVar.set(noneItem)
     combo.pack(side="left")
     self.combobox_r_i = comboVar
     ##
     frame.pack(fill="x")
     ###################
     frame = tix.Frame(revFrame)
     ##
     label = tix.Label(frame, text="  Path:")
     label.pack(side="left")
     ##
     entry = tix.Entry(frame)
     entry.pack(side="left", fill="x", expand=True)
     # entry.bind_all("<KeyPress>", self.entry_r_i_changed)
     self.entry_r_i = entry
     ##
     button = tix.Button(
         frame,
         text="Browse",
         command=self.r_browse_i,
         # bg="#f0f000",
         # activebackground="#f6f622",
     )
     button.pack(side="left")
     ##
     button = tix.Button(
         frame,
         text="Load",
         command=self.r_load,
         # bg="#7777ff",
     )
     button.pack(side="left")
     ###
     frame.pack(fill="x")
     ###################
     frame = tix.Frame(revFrame)
     ##
     label = tix.Label(frame, text="Output Tabfile")
     label.pack(side="left")
     ###
     entry = tix.Entry(frame)
     entry.pack(side="left", fill="x", expand=True)
     # entry.bind_all("<KeyPress>", self.entry_r_i_changed)
     self.entry_r_o = entry
     ##
     button = tix.Button(
         frame,
         text="Browse",
         command=self.r_browse_o,
         # bg="#f0f000",
         # activebackground="#f6f622",
     )
     button.pack(side="left")
     ##
     frame.pack(fill="x")
     ##############################
     if path:
         self.entry_i.insert(0, path)
         self.entry_changed()
         self.load()
예제 #28
0
 def about_clicked(self):
     about = tix.Toplevel(width=600)  # bg="#0f0" does not work
     about.title("About PyGlossary")
     about.resizable(False, False)
     set_window_icon(about)
     ###
     msg1 = tix.Message(
         about,
         width=350,
         text="PyGlossary %s (Tkinter)" % VERSION,
         font=("DejaVu Sans", 13, "bold"),
     )
     msg1.pack(fill="x", expand=True)
     ###
     msg2 = tix.Message(
         about,
         width=350,
         text=aboutText,
         font=("DejaVu Sans", 9, "bold"),
         justify=tix.CENTER,
     )
     msg2.pack(fill="x", expand=True)
     ###
     msg3 = tix.Message(
         about,
         width=350,
         text=homePage,
         font=("DejaVu Sans", 8, "bold"),
         fg="#3333ff",
     )
     msg3.pack(fill="x", expand=True)
     ###
     msg4 = tix.Message(
         about,
         width=350,
         text="Install PyGTK to have a better interface!",
         font=("DejaVu Sans", 8, "bold"),
         fg="#00aa00",
     )
     msg4.pack(fill="x", expand=True)
     ###########
     frame = tix.Frame(about)
     ###
     button = tix.Button(
         frame,
         text="Close",
         command=about.destroy,
         # bg="#ff0000",
         # activebackground="#ff5050",
     )
     button.pack(side="right")
     ###
     button = tix.Button(
         frame,
         text="License",
         command=self.about_license_clicked,
         # bg="#00e000",
         # activebackground="#22f022",
     )
     button.pack(side="right")
     ###
     button = tix.Button(
         frame,
         text="Credits",
         command=self.about_credits_clicked,
         # bg="#0000ff",
         # activebackground="#5050ff",
     )
     button.pack(side="right")
     ###
     frame.pack(fill="x")
예제 #29
0
    def _createWidgets_(self):
        self.fsFrame = tk.Frame(self.mFrame)
        self.tk_setPalette(background = '#F2D7D5') ##F2D7D5
        self.btQuit = tk.Button(self.mFrame)
        self.btQuit.config(text = 'Завершить', command = self.root.destroy)
        self.btQuit.pack(side =tk.BOTTOM)
        ##self.loadFrame = tk.LabelFrame(self.fsFrame)
        ##self.listBMsg = tk.Listbox(self.loadFrame, relief='flat')

        self.topElemsFrame = tk.Frame(self.fsFrame)
        self.btnLstFrame = tk.LabelFrame(self.topElemsFrame)
        self.smplUnqOptFrame = tk.Frame(self.topElemsFrame)
        
        self.smplUnqOptLabelF = tk.LabelFrame(self.smplUnqOptFrame)
        
        self._lbSmplUnqOptLabelF_ = self.getSubWgts(self.smplUnqOptLabelF, tk._dummyLabel)
        self._lbSmplUnqOptLabelF_.config(text = "Уник. сэмпл.")
        self._frSmplUnqOptLabelF_ = self.getSubWgts(self.smplUnqOptLabelF, tk._dummyFrame)
        
        self.cbIfCutUrl = tk.Checkbutton(self._frSmplUnqOptLabelF_, text = "Сократ. Url в назв. сэмпл.", variable = self._varIfCutUrlInSmpl_)
        
        self.smplThruNum = tk.LabelFrame(self._frSmplUnqOptLabelF_)
        self._lbSmplThruNum_ = self.getSubWgts(self.smplThruNum, tk._dummyLabel)
        self._lbSmplThruNum_.config(text = "Скозн. нумер.")
        self._frSmplThruNum_ = self.getSubWgts(self.smplThruNum, tk._dummyFrame)
        self.smplThruNumCntrl = tk.Radiobutton(self._frSmplThruNum_, text = "Контроллер", variable = self._varRbSmplThruNum_, value = "Controller")
        self.smplThruNumThGr = tk.Radiobutton(self._frSmplThruNum_, text = "ТредГрупп", variable = self._varRbSmplThruNum_, value = "ThreadGroup")
        self.smplThruNumTstPl = tk.Radiobutton(self._frSmplThruNum_, text = "ТестПлан", variable = self._varRbSmplThruNum_, value = "TestPlan")
        self.smplThruNumCntrl.pack(side = tk.TOP, anchor = tk.W)
        self.smplThruNumThGr.pack(side = tk.TOP, anchor = tk.W)
        self.smplThruNumTstPl.pack(side = tk.TOP, anchor = tk.W)
        
        self.cbIfNotRstrUnqInSmpl = tk.Checkbutton(self._frSmplUnqOptLabelF_, text = "Не восст. ориг. назв. сэмпл.", variable = self._varCbIfNotRstrUnqInSmpl_)
        
        self.cbIfCutUrl.pack(side = tk.TOP, anchor = tk.W)
        self.smplThruNum.pack(side = tk.TOP, anchor = tk.W)
        self.cbIfNotRstrUnqInSmpl.pack(side = tk.TOP, anchor = tk.W)
        
        self.smplUnqOptLabelF.pack(anchor = tk.E)
        self.smplUnqOptFrame.config(width = self.smplThruNum.winfo_reqwidth(), padx = 100)
        
        self.paramVolatilFrame = tk.Frame(self.topElemsFrame)
        self.update_idletasks()
        leftCornerWidth = self._frSmplUnqOptLabelF_.winfo_reqwidth() + int(self.smplUnqOptLabelF.cget("borderwidth")) * 2
        leftCornerHeight = self.smplUnqOptLabelF.winfo_reqheight() + 2
        self.paramVolatilFrame.config(width = leftCornerWidth + 202, height = leftCornerHeight)
        self.paramVolatilFrame.pack_propagate(0)
        
        self.paramVolatilLabel = tk.LabelFrame(self.paramVolatilFrame)
        self._lbParamVolatilLabel_ = self.getSubWgts(self.paramVolatilLabel, tk._dummyLabel)
        self._lbParamVolatilLabel_.config(text = "Статистика")
        self._frParamVolatilLabel_ = self.getSubWgts(self.paramVolatilLabel, tk._dummyFrame)
        
        self.frBtGetVolatilPrm = tk.Frame(self._frParamVolatilLabel_)
        self.btBtGetVolatilPrm = tk.Button(self.frBtGetVolatilPrm, text="Получ. стат. по парам.")

        self.rBtGetVolatilPrm = tk.Radiobutton(self.frBtGetVolatilPrm, text = 'Волатил.   ', variable = self._volatilPrm_, value = True)
        self.rBtGetNonVolatilPrm = tk.Radiobutton(self.frBtGetVolatilPrm, text = 'Не волатил.', variable = self._volatilPrm_, value = False)
        self.btBtGetVolatilPrm.config(relief='groove')
        self.btBtGetVolatilPrm.config(command = self.prcdfGetVolatilPrms)
        self.frBtGetVolatilPrm.pack(side = tk.TOP, anchor = tk.W)
        self.btBtGetVolatilPrm.pack(side = tk.LEFT)
        self.rBtGetVolatilPrm.pack(side = tk.TOP, anchor = tk.W)
        self.rBtGetNonVolatilPrm.pack(side = tk.TOP, anchor = tk.W)

        self.paramVolatilLabel.pack(anchor = tk.W)

        ##self.msgsToAscFrame = tk.Listbox(self.loadFrame, relief='flat', selectmode='multiple')
        ##self.vScroll = tk.Scrollbar(self.loadFrame, orient=tk.VERTICAL)
        ##self.msgsToAscFrame.config( yscrollcommand=self.vScroll.set)
        self.consFrame = tk.LabelFrame(self.mFrame)
        #self.varsFrame = tk.LabelFrame(self.fsFrame)

        ##self.btnCollctnFrame = tk.LabelFrame(self.fsFrame)
        
        self.mCllctnFrame = tk.Frame(self.mFrame)
        
        self._lbBtnLstFrame_ = self.getSubWgts(self.btnLstFrame, tk._dummyLabel)
        self._lbBtnLstFrame_.config(text = 'Раб. с исх. Xml-дер.')
        self._frBtnLstFrame_ = self.getSubWgts(self.btnLstFrame, tk._dummyFrame)
        
        self.varsFrame = tk.Frame(self._frBtnLstFrame_, borderwidth=2, bg = 'blue')
        self.vrSPathFrame = tk.Label(self.varsFrame)
        self.vrFnameFrame = tk.Label(self.varsFrame)
        self.vrUnqFNmFrame = tk.Label(self.varsFrame)
        #self.vrPileCllctnFrame = tk.Label(self.varsFrame)
        self.vrRestreFNmFrame = tk.Label(self.varsFrame)
        
        self._btnLstFrame_ = tk.Frame(self._frBtnLstFrame_, borderwidth = 2)
        
        self.btCatchJMXFiles = tk.Button(self._btnLstFrame_, text="Собрать все \n.jmx файлы", fg="green")
        
	#self.btCatchJMXFiles.config(command = self.testFrame)
        self.btCatchJMXFiles.config(command = self.prcdCatchJMXFiles)
        self.btCatchJMXFiles.config(relief='raised')
        self.btCatchJMXFiles.pack(fill = 'x')
        #self.jmscdObj.setFName = 'toParce.jmx'

        self.btGetJMXMkTree = tk.Button(self._btnLstFrame_, text="Получить дерево из \n.jmx файла", fg="green")
        self.btGetJMXMkTree.config(command = self.prcdGetJMXMkTree)
        self.btGetJMXMkTree.config(relief='raised')
        self.btGetJMXMkTree.pack(fill = 'x')
        
        self.btTreeUnqNms = tk.Button(self._btnLstFrame_, text="Сген. колл. \nс уник. именами")
        self.btTreeUnqNms.config(command = self.prcdTreeUnqNms)
        self.btTreeUnqNms.config(relief='raised', state = tk.DISABLED)
        self.btTreeUnqNms.pack(fill = 'x')
        
        self.btRstrOrigNms = tk.Button(self._btnLstFrame_, text="Восст. ориг. имена\nдля получен. колл.")
        self.btRstrOrigNms.config(command = self.prcdRstrOrigNms)
        self.btRstrOrigNms.config(relief='raised')
        self.btRstrOrigNms.pack(fill = 'x')
        
        self.vrSPathLabel = tk.Label(self.vrSPathFrame)
        self.vrSPathValue = tk.Entry(self.vrSPathFrame, bg='white')
        self.vrSPathLabel.config(text='Каталог с (*.jmx)  файл.:', justify = tk.LEFT)
        self.vrSPathValue.config(justify = tk.LEFT)
        self.vrSPathValue.insert(0, self.jmscdObj.setPATH)
        self.vrSPathLabel.pack(side = tk.LEFT)
        self.vrSPathValue.pack(side = tk.LEFT)
        self.vrSPathFrame.pack(side = tk.TOP)
        
        self.vrFnameLabel = tk.Label(self.vrFnameFrame)
        self.vrFnameValue = tk.Entry(self.vrFnameFrame, bg='white')
        self.vrFnameLabel.config(text='Файл(*.jmx) для парам.:', justify = tk.LEFT)
        self.vrFnameValue.config(justify = tk.LEFT)
        self.vrFnameValue.insert(0, self.jmscdObj.setFName)
        self.vrFnameLabel.pack(side = tk.LEFT)
        self.vrFnameValue.pack(side = tk.LEFT)
        self.vrFnameFrame.pack(side=tk.TOP)
        
        self.vrUnqFNmLabel = tk.Label(self.vrUnqFNmFrame)
        self.vrUnqFNmValue = tk.Entry(self.vrUnqFNmFrame, bg = 'white')
        self.vrUnqFNmLabel.config(text='Файл(*.jmx), униф. элм.:', justify = tk.LEFT)
        self.vrUnqFNmValue.config(justify = tk.LEFT)
        self.vrUnqFNmValue.insert(0, self.jmscdObj.outFileUniqueNames)
        self.vrUnqFNmLabel.pack(side = tk.LEFT)
        self.vrUnqFNmValue.pack(side = tk.LEFT)
        self.vrUnqFNmFrame.pack(side=tk.TOP)
        
        self.vrRestreFNmLabel = tk.Label(self.vrRestreFNmFrame)
        self.vrRestreFNmValue = tk.Entry(self.vrRestreFNmFrame, bg = 'white')
        self.vrRestreFNmLabel.config(text='Файл(*.jmx), восcт. элм.:', justify = tk.LEFT)
        self.vrRestreFNmValue.config(justify = tk.LEFT)
        self.vrRestreFNmValue.insert(0, self.jmscdObj.outFileRestrdOrig)
        self.vrRestreFNmLabel.pack(side = tk.LEFT)
        self.vrRestreFNmValue.pack(side = tk.LEFT)
        self.vrRestreFNmFrame.pack(side=tk.TOP)
        
        self._btnLstFrame_.pack(side = tk.TOP)
        self.varsFrame.pack(side=tk.TOP)
        ##
        
        
        self.frPileOptns = tk.LabelFrame(self.mCllctnFrame)
        self._lbFrPileOptns_ = self.getSubWgts(self.frPileOptns, tk._dummyLabel)
        self._lbFrPileOptns_.config(text = 'Получ. осн. колл.')
        self._frPileOptns_ = self.getSubWgts(self.frPileOptns, tk._dummyFrame)
        self.scrollPileMCllt = tk.Scrollbar(self._frPileOptns_, orient = tk.VERTICAL)
        self.scrollPileMCllt.pack(side = tk.RIGHT, fill = 'y')
        self.lsbxPileMCllct = tk.Listbox(self._frPileOptns_, height = 4, width = 34, yscrollcommand = self.scrollPileMCllt.set)

        for itm in range(4):
            self.lsbxPileMCllct.insert(tk.END, '--')
            
        self.btPileMCllct = tk.Button(self._frPileOptns_, text="Аккумул. раб. коллекц.")
        self.btPileMCllct.config(command = self.prcdPileMCllct, relief='groove')
        self.lsbxPileMCllct.pack(side = tk.TOP)
        self.btPileMCllct.pack(side = tk.TOP)
        self.frPileOptns.pack(side = tk.LEFT)
        
        self.scrollPileMCllt.config(command = self.lsbxPileMCllct.yview)
        
        self.frOutRslts = tk.LabelFrame(self.mCllctnFrame)
        self._lbFrOutRslts_ = self.getSubWgts(self.frOutRslts, tk._dummyLabel)
        self._lbFrOutRslts_.config(text = 'Текущ. знач.')
        self._frOutRslts_ = self.getSubWgts(self.frOutRslts, tk._dummyFrame)
        self.entStrVar = tk.StringVar(self._frOutRslts_)
        #self.entStrVar.set(self.jmscdObj.entityNames[2]) # default value
        self.lstWrkEnts = tk.OptionMenu(self._frOutRslts_, variable = self.entStrVar)
        for ent in self.jmscdObj.entityNames:
            self.lstWrkEnts.add_command(ent)
        self.entStrVar.set(self.jmscdObj.entityNames[2])
        #self.lstWrkEnts = tk.Listbox(self.mCllctnFrame)
        
        ##Опция выбора сущности на данный момент выключена
        ####self.lstWrkEnts.pack(side = tk.TOP)
        self.tstOutText = tk.Text(self._frOutRslts_, state = tk.DISABLED, bg='#FFEFD5')#, width=64)
        self.tstOutText.pack(side = tk.TOP)
        self.txtWdgtDelete(False)
        self.txtWdgtInsert(self._initText_)
        #
        self.frWrInfExtCntrlElm = tk.Frame(self._frOutRslts_)
        self.btWriteChngsToF = tk.Button(self.frWrInfExtCntrlElm, text='Запис. изм.\nв файл')
        self.btWriteChngsToF.config(command = self.prcdWrtXmlTree)
        self.btUpdateXMLTree = tk.Button(self.frWrInfExtCntrlElm, text='Обнов. \nxml-дерево')
        self.btUpdateXMLTree.config(command = self.prcdUpdtXMLTree, state = tk.DISABLED)
        self.btUpdateXMLTree.pack(side = tk.LEFT)
        self.btWriteChngsToF.pack(side = tk.LEFT)
        self.frWrInfExtCntrlElm.pack(side = tk.BOTTOM)
        #
        self.frOutRslts.pack(side = tk.LEFT)

        ###
        
        self.frGetCollctnData = tk.Frame(self.mCllctnFrame)
        #
        self.frGetListKeys = tk.LabelFrame(self.frGetCollctnData)
        self._frGetListKeys_ = self.getSubWgts(self.frGetListKeys, tk._dummyFrame)
        self.frBtGetLstKeys = tk.Frame(self._frGetListKeys_)
        self.btGetListKeys = tk.Button(self.frBtGetLstKeys, text="Список получ. ключей:")
        self.varRBtLstKeys = tk.IntVar()
        self.varRBtLstKeys.set(1)
        self.rBtLstKeysPrms = tk.Radiobutton(self.frBtGetLstKeys, text = 'Парам. ', variable = self.varRBtLstKeys, value = 1)
        self.rBtLstKeysLnks = tk.Radiobutton(self.frBtGetLstKeys, text = 'Ссылки', variable = self.varRBtLstKeys, value = 2)
        self.btGetListKeys.config(relief='groove')
        self.btGetListKeys.config(command = self.prcdfGetListKeys)
        self._lbGetListKeys_ = self.getSubWgts(self.frGetListKeys, tk._dummyLabel)
        self._lbGetListKeys_.config(text = 'Раб. с осн. коллекц.')
        self.frBtGetLstKeys.pack(side = tk.TOP, anchor = tk.W)
        self.btGetListKeys.pack(side = tk.LEFT)
        self.rBtLstKeysPrms.pack(side = tk.TOP, anchor = tk.E)
        self.rBtLstKeysLnks.pack(side = tk.TOP, anchor = tk.E)
        self.frGetListKeys.pack(side = tk.TOP, fill = 'x')
        #
        self.frGetDictData = tk.Frame(self._frGetListKeys_)
        self.frGetDictData.config(borderwidth = 2, bg = 'green')
        ##
        self.frGetDataDictItem = tk.Frame(self.frGetDictData)
        self.vlGetDataDictItem = tk.Entry(self.frGetDataDictItem, bg='white')
        self.vlGetDataDictItem.insert(0, '<знач.ключа>')
        self.btGetDataDictItem = tk.Button(self.frGetDataDictItem, text="Все знач.\nпо задан. ключу:")
        self.btGetDataDictItem.config(command = self.prcdGetDataDictItem)
        self.btGetDataDictItem.config(relief='groove')
        self.btGetDataDictItem.pack(side= tk.LEFT)
        self.vlGetDataDictItem.pack(side = tk.RIGHT, fill = 'y')
        self.frGetDataDictItem.pack(side = tk.TOP)
        ##
        self.frGetScrLstByNm = tk.Frame(self.frGetDictData)
        self.btGetScrLstByNm = tk.Button(self.frGetScrLstByNm, text="Все контрлр.\nпо задан. ключу:")
        self.btGetScrLstByNm.config(command = self.prcdGetScrLstByNm)
        self.btGetScrLstByNm.config(relief='groove')
        self.vlGetScrLstByNm = tk.Entry(self.frGetScrLstByNm, bg='white')
        self.vlGetScrLstByNm.insert(0, '<знач.ключа>')
        self.chkBtVar = tk.BooleanVar(self.frGetScrLstByNm)
        self.chkBtVar.set(False)
        self.chkGetScrLstByNm = tk.Checkbutton(self.frGetScrLstByNm, text='Вывод сэмплр.', variable=self.chkBtVar)
        self.btGetScrLstByNm.pack(side= tk.LEFT)
        self.vlGetScrLstByNm.pack(side = tk.TOP)
        self.chkGetScrLstByNm.pack(side = tk.LEFT)
        self.frGetScrLstByNm.pack(side = tk.TOP)
        ##
        self.frGetScrFncByKeyVal = tk.Frame(self.frGetDictData)
        self.btGetScrFncByKeyVal = tk.Button(self.frGetScrFncByKeyVal, text="Все контрлр.\nпо  паре  кл.-зн.:")
        self.btGetScrFncByKeyVal.config(command = self.prcdGetScrFncByKeyVal)
        self.btGetScrFncByKeyVal.config(relief='groove')
        self.vlGetScrFncByKeyVal = tk.Entry(self.frGetScrFncByKeyVal, bg='white')
        self.vlGetScrFncByKeyVal.insert(0, '<знач.ключа>')
        self.vrGetScrFncByKeyVal = tk.Entry(self.frGetScrFncByKeyVal, bg='white')
        self.vrGetScrFncByKeyVal.insert(0, '<знач.парам.>')
        self.chkKeyVlVar = tk.BooleanVar(self.frGetScrFncByKeyVal)
        self.chkKeyVlVar.set(False)
        self.chkGetScrFncByKeyVal = tk.Checkbutton(self.frGetScrFncByKeyVal, text='Вывод сэмплр.', variable=self.chkKeyVlVar)
        self.btGetScrFncByKeyVal.pack(side= tk.LEFT, fill='y')
        self.vlGetScrFncByKeyVal.pack(side = tk.TOP)
        self.vrGetScrFncByKeyVal.pack(side = tk.TOP)
        self.chkGetScrFncByKeyVal.pack(side = tk.LEFT)
        self.frGetScrFncByKeyVal.pack(side = tk.TOP, fill='x')
        ##
        self.frGetValByKSF = tk.Frame(self.frGetDictData)
        self.frGetValByKSF.config(borderwidth = 1, bg = 'red')
        self.blnMsg = tk.Balloon(self.frGetValByKSF, initwait = 350, bg='yellow')
        self.blnMsgText = 'Внимание!\nНазвания контроллеров и сэмплеров (возможно) были изменены,\nследует сверять в jmeter по файлу "(*.jmx) униф. эл"'
        self.blnMsg.bind_widget(self.frGetValByKSF, msg = self.blnMsgText)
        self.btGetValByKSF = tk.Button(self.frGetValByKSF, text="Значен. для\n кл.-кнтр.-смпл.:")
        self.btGetValByKSF.config(command = self.prcdGetValByKSF)
        self.btGetValByKSF.config(relief='groove')
        self.vlGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white')
        self.vlGetValByKSF.insert(0, '<знач.ключа>')
        self.ctGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white')
        self.ctGetValByKSF.insert(0, '<назв. контрлр.>')
        self.smGetValByKSF = tk.Entry(self.frGetValByKSF, bg='white')
        self.smGetValByKSF.insert(0, '<назв. сэмплр.>')
        self.btGetValByKSF.pack(side= tk.LEFT, fill='y')
        self.vlGetValByKSF.pack(side = tk.TOP)
        self.ctGetValByKSF.pack(side = tk.TOP)
        self.smGetValByKSF.pack(side = tk.TOP)
        self.frGetValByKSF.pack(side = tk.TOP, fill='x')
        ##
        self.frSetValsToSlctn = tk.Frame(self._frGetListKeys_, pady = 2)
        self.btSetValsToSlctn = tk.Button(self.frSetValsToSlctn, text = 'Установ.\n для дан.\n элемен.\n словар.')
        self.btSetValsToSlctn.config(command = self.prcdSetValsToSlctn, state = tk.DISABLED, relief = "groove")
        self.lblSetValsToSlctn = tk.Label(self.frSetValsToSlctn, text = ' <==> ')
        self.entSetValsToSlctn = tk.Entry(self.frSetValsToSlctn, bg='white')
        self.entSetValsToSlctn.insert(0, '*новое знач.*')
        self.btSetValsToSlctn.pack(side = tk.LEFT, anchor=tk.W)
        self.lblSetValsToSlctn.pack(side = tk.LEFT)
        self.entSetValsToSlctn.pack(side = tk.RIGHT, anchor=tk.E)
        ###
        self.frGetDictData.pack(side = tk.TOP)
        self.frSetValsToSlctn.pack(side = tk.TOP, anchor = tk.W)
        #
        self.frGetCollctnData.pack(side = tk.LEFT)

        #for lstEntr in self.jmscdObj.entityNames:
        #    self.lstWrkEnts.insert(tk.END, lstEntr)
        
        self.fsFrame.pack(side="top", fill='x')
        self.mCllctnFrame.pack(side=tk.LEFT, fill='x')
        ##self.loadFrame.pack(side="top", fill='x')
        self.smplUnqOptFrame.pack(side = tk.RIGHT, anchor = tk.E)
        self.btnLstFrame.pack(side = tk.RIGHT)
        self.paramVolatilFrame.pack(side = tk.RIGHT)
        self.topElemsFrame.pack(side="top", fill='y')
예제 #30
0
#-*-coding=utf-8-*-
import encodings
encodings.normalize_encoding('utf_8')
from tkinter import tix
f = open("result.txt", "rt")
x = f.read()
f.close()
x = x.split()
num = len(x)
root = tix.Tk()
frame = tix.Frame(root)
frame.pack()
scrolledwin = tix.ScrolledWindow(frame)
scrolledwin.pack(side="right", fill="y")
scr = scrolledwin.window
col = 0
line_mark = 0
row_ = 0
bigfont = ("Helvetica", "50", 'bold')
for i in range(num):
    if col == 9:
        col = 0
        row_ += 1
    txt = x[i]
    globals()['btn{}'.format(i)] = tix.Button(scr,
                                              text="%s" % txt,
                                              bg="ivory",
                                              fg="brown",
                                              activebackground='yellow',
                                              activeforeground="blue")
    globals()['btn{}'.format(i)].config(font=bigfont)