コード例 #1
0
    def cdeprogressbar():
        widg = "Progressbar"
        ind = indexunique("pgb")
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())

        if (cancel != "True"):
            parent = Treeview.inserertreeview(widg, ind)

            dicopt = formedicopt(opt)
            CodePython.ecritdata(ind,
                                 ttk.Progressbar,
                                 parent,
                                 dicopt,
                                 usettk=True)
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['padx'] = "2m"
            dicpack['pady'] = "2m"
            CodePython.ecritpack(ind, dicpack)

            pgb = creewidget(ttk.Progressbar,
                             dictwidg[parent],
                             ind,
                             dicopt,
                             usettk=True)
            pgb.pack(side=pack, padx="1m", pady="2m")
コード例 #2
0
    def cdemenubutton():
        widg = "Menubutton"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            #retour au destroy de la toplevel
            ind = indexunique("mb")
            dicopt = formedicopt(opt)

            parent = Treeview.inserertreeview("Widget " + widg, ind)
            CodePython.ecritdata(ind, Menubutton, parent, dicopt)
            dicpack = {}
            dicpack['side'] = "left"
            CodePython.ecritpack(ind, dicpack)

            #fich.insert(END,'mb=Menubutton(root, text="'+libelle+'", underline=0)\n')
            fich.insert(END,
                        '\t\tmenu1=Menu(' + str(ind) + ', tearoff=False)\n')
            fich.insert(END, '\t\tmenu1.add_separator()\n')
            fich.insert(END, "\t\t" + str(ind) + '["menu"]=menu1\n')
            mb = creewidget(Menubutton, dictwidg[parent], ind, dicopt)
            #mb=Menubutton(top1, text=""+libelle+"", underline=0)
            menu1 = Menu(mb, tearoff=False)
            menu1.add_separator()
            mb["menu"] = menu1
            mb.pack(dicpack)
コード例 #3
0
    def cdeentry():
        widg = "Entry"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())

        if (cancel != "True"):
            #retour au destroy de la toplevel
            ind = indexunique("txt")
            parent = Treeview.inserertreeview(widg, ind)
            dicopt = formedicopt(opt)

            CodePython.ecritdata(ind, Entry, parent, dicopt)

            fich.insert(END, '\t\tvar=StringVar()\n')
            #fich.insert(END,'txt=Entry(root,width=20, relief="sunken",state=""+etat+"" , bd=2, textvariable=var)\n')
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['padx'] = "2m"
            dicpack['pady'] = "2m"
            CodePython.ecritpack(ind, dicpack)

            var = StringVar()
            txt = creewidget(Entry, dictwidg[parent], ind, dicopt)
            #txt=Entry(top1,width=20, relief="sunken", state=etat ,bd=2, textvariable=var)
            txt.pack(dicpack)
コード例 #4
0
    def cdebutton():
        #choix state, text
        widg = "Button"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            #retour au destroy de la toplevel
            ind = indexunique("btn")
            parent = Treeview.inserertreeview(widg, ind)
            dicopt = {}
            for arg in opt.args:
                (x, y) = arg.split("=")
                dicopt[x] = y.strip('"')
            print(dicopt)

            CodePython.ecritdata(ind, Button, parent, dicopt)
            dicpack = {}
            dicpack['side'] = "left"
            CodePython.ecritpack(ind, dicpack)

            btn = creewidget(Button, dictwidg[parent], ind, dicopt)
            btn.pack(dicpack)
コード例 #5
0
    def cdenotebook():
        #ttk widget
        widg = "Notebook"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            dicopt = formedicopt(opt)
            ind = indexunique("nb")
            parent = Treeview.inserertreeview("Container ttk Notebook", ind)
            ltree.focus(ind)

            CodePython.ecritdata(ind,
                                 ttk.Notebook,
                                 parent,
                                 dicopt,
                                 usettk=True)
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['padx'] = "2m"
            dicpack['pady'] = "5m"
            CodePython.ecritpack(ind, dicpack)

            nb = creewidget(ttk.Notebook,
                            dictwidg[parent],
                            ind,
                            dicopt,
                            usettk=True)
            nb.pack(side="left", padx="2m", pady="5m")

            #insere 2 label frame pour matérialiser les 2 pages
            indlf1 = indexunique("lf")
            Treeview.inserertreeview("Container LabelFrame 1", indlf1)

            fich.insert(END, "\t\t" + str(indlf1) + ' = Frame(' + ind + ')\n')
            fich.insert(END, "\t\t" + str(indlf1) + '.pack()\n')
            fich.insert(
                END, "\t\t" + str(ind) + '.add(' + str(indlf1) +
                ', text="Page1")\n')
            f1 = Frame(nb)
            f1.pack(side="left")
            nb.add(f1, text="Page1")
            dictwidg[indlf1] = f1

            indlf2 = indexunique("lf")
            Treeview.inserertreeview("Container LabelFrame 2", indlf2)
            fich.insert(END, "\t\t" + str(indlf2) + ' = Frame(' + ind + ')\n')
            fich.insert(END, "\t\t" + str(indlf2) + '.pack()\n')
            fich.insert(
                END, "\t\t" + str(ind) + '.add(' + str(indlf2) +
                ', text="Page2")\n')
            f2 = Frame(nb)
            f2.pack(side="left")
            nb.add(f2, text="Page2")
            dictwidg[indlf2] = f2
            ltree.focus('')
コード例 #6
0
    def cdepanedwindow():
        #donner choix horizontal/vertical
        widg = "PanedWindow"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            ind = indexunique("pw")
            dicopt = formedicopt(opt)

            parent = Treeview.inserertreeview("Container " + widg, ind)
            CodePython.ecritdata(ind, PanedWindow, parent, dicopt)
            pw = creewidget(PanedWindow, dictwidg[parent], ind, dicopt)

            ltree.focus(ind)
            indlf1 = indexunique("lf")
            Treeview.inserertreeview("Container Labelframe 1", indlf1)
            fich.insert(
                END, "\t\t" + str(indlf1) + "= ttk.Labelframe(" + str(ind) +
                ", text='Pane1', width=100, height=100)\n")
            fich.insert(END, "\t\t" + str(ind) + '.add(' + str(indlf1) + ')\n')
            lf1 = LabelFrame(pw, text='Pane1', width=100, height=100)
            pw.add(lf1)
            dictwidg[indlf1] = lf1

            indlf2 = indexunique("lf")
            Treeview.inserertreeview("Container Labelframe 2", indlf2)
            #2eme plus petit si horiz => en largeur
            if dicopt['orient'] == "horizontal":
                fich.insert(
                    END, "\t\t" + str(indlf2) + " = ttk.Labelframe(" +
                    str(ind) + ", text='Pane2', width=80, height=100)\n")
                lf2 = LabelFrame(pw, text='Pane2', width=80, height=100)
            else:
                fich.insert(
                    END, "\t\t" + str(indlf2) + " = ttk.Labelframe(" +
                    str(ind) + ", text='Pane2', width=100, height=80)\n")
                lf2 = LabelFrame(pw, text='Pane2', width=100, height=80)
            fich.insert(END, "\t\t" + str(ind) + '.add(' + str(indlf2) + ')\n')

            pw.add(lf2)
            pw.pack()
            CodePython.ecritpack(ind)
            dictwidg[indlf2] = lf2
            #enleve le focus pour la suite
            ltree.focus('')
コード例 #7
0
    def cdespinbox():
        widg = "Spinbox"
        ind = indexunique("sp")
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            parent = Treeview.inserertreeview(widg, ind)
            dicopt = formedicopt(opt)
            CodePython.ecritdata(ind, Spinbox, parent, dicopt)
            dicpack = {}
            dicpack['side'] = "left"
            CodePython.ecritpack(ind, dicpack)

            sp = creewidget(Spinbox, dictwidg[parent], ind, dicopt)
            sp.pack(side=pack)
コード例 #8
0
    def cdescale():
        #choix orientation
        widg = "Scale"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            ind = indexunique("sc")
            parent = Treeview.inserertreeview(widg, ind)

            dicopt = formedicopt(opt)

            CodePython.ecritdata(ind, Scale, parent, dicopt)
            CodePython.ecritpack(ind)
            curseur = creewidget(Scale, dictwidg[parent], ind, dicopt)
            curseur.pack()
コード例 #9
0
    def cdecanvas():
        #donne choix background, borderwidth, relief
        widg = "Canvas"
        ind = indexunique("ca")
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            parent = Treeview.inserertreeview(widg, ind)
            dicopt = formedicopt(opt)

            CodePython.ecritdata(ind, Canvas, parent, dicopt)
            CodePython.ecritpack(ind)

            ca = creewidget(Canvas, dictwidg[parent], ind, dicopt)
            ca.pack()
コード例 #10
0
    def cdelabelframe():
        widg = "LabelFrame"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            ind = indexunique("fr")
            dicopt = formedicopt(opt)
            parent = Treeview.inserertreeview("Container " + widg, ind)
            CodePython.ecritdata(ind, LabelFrame, parent, dicopt)
            dicpack = {}
            dicpack['padx'] = "2m"
            dicpack['pady'] = "2m"
            CodePython.ecritpack(ind, dicpack)

            fr = creewidget(LabelFrame, dictwidg[parent], ind, dicopt)
            fr.pack(padx="2m", pady="2m")
コード例 #11
0
def Modif():
    #ouvrir le module de choix
    select = ltree.focus()
    if select != "":
        #select contient id unique
        #retrouver le code data entre < > et </ >
        deb = fich.search("#<" + select, 0.0)
        fin = fich.search("#</" + select + ">", 0.0)
        listeoptions = {}

        #Récuperer le type de widget à modifier
        debwidg = fich.search(":", deb)
        finwidg = fich.search(">", deb)
        widg = fich.get(CodePython.gagnecaracteresuivant(debwidg), finwidg)
        #print("widget à modifier "+widg)

        #chercher les virgules devant option="valeur"
        #for i = deb to fin:
        sep1 = fich.search(",", deb)
        sep1 = CodePython.gagnecaracteresuivant(sep1)
        sep2 = fich.search(")", deb)
        listeoptions = (fich.get(sep1, sep2))
        listeoptions = (listeoptions.split(","))
        #print(options avant modifs " + str(listeoptions))
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        if (cancel != "True"):
            #retour au destroy de la toplevel
            #print ("options après modifs" +str(opt.args))

            #replacer dans la ligne de code
            fich.delete(sep1, sep2)
            newline = ""
            for arg in (opt.args):
                if (newline != ""): newline += ","
                newline = newline + arg
                #changer le widget
                expr = "dictwidg[select].configure(" + arg + ")"
                exec(expr)
                #dictwidg[select].configure(arg)
            fich.insert(sep1, newline)
コード例 #12
0
    def cdelabel():
        widg = "Label"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            ind = indexunique("lbl")
            dicopt = formedicopt(opt)
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['padx'] = "2m"
            dicpack['pady'] = "2m"

            parent = Treeview.inserertreeview(widg, ind, dicpack)
            CodePython.ecritdata(ind, Label, parent, dicopt)
            CodePython.ecritpack(ind, dicpack)

            lbl = creewidget(Label, dictwidg[parent], ind, dicopt)
            lbl.pack(dicpack)
コード例 #13
0
    def cdetext():
        widg = "Text"
        ind = indexunique("txt")

        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())

        if (cancel != "True"):
            parent = Treeview.inserertreeview(widg, ind)

            dicopt = formedicopt(opt)

            CodePython.ecritdata(ind, Text, parent, dicopt)
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['expand'] = "True"
            dicpack['fill'] = "both"
            CodePython.ecritpack(ind, dicpack)

            txt = creewidget(Text, dictwidg[parent], ind, dicopt)
            txt.pack(dicpack)
コード例 #14
0
    def cdelistbox():
        widg = "Listbox"
        ind = indexunique("lb")
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            parent = Treeview.inserertreeview(widg, ind)

            dicopt = formedicopt(opt)

            CodePython.ecritdata(ind, Listbox, parent, dicopt)
            fich.insert(END, "\t\t" + str(ind) + '.insert(1,"valeur1")\n')
            fich.insert(END, "\t\t" + str(ind) + '.insert(2,"valeur2")\n')
            dicpack = {}
            dicpack['side'] = "left"
            CodePython.ecritpack(ind, dicpack)

            lb = creewidget(Listbox, dictwidg[parent], ind, dicopt)
            lb.insert(1, "valeur1")
            lb.insert(2, "valeur2")
            lb.pack(dicpack)
コード例 #15
0
    def cdeframe():
        widg = "Frame"
        listeoptions = extrairelisteoptions(widg)
        cancel = StringVar()
        cancel.set("False")
        opt = mod_options.Proprietes(root, widg, listeoptions, cancel=cancel)
        cancel = str(cancel.get())
        if (cancel != "True"):
            #opt.args contient les options récupérées ss forme de liste
            #à mettre sous forme de dict
            ind = indexunique("fr")
            dicopt = formedicopt(opt)
            dicpack = {}
            dicpack['side'] = "left"
            dicpack['padx'] = "2m"
            dicpack['pady'] = "2m"
            parent = Treeview.inserertreeview("Container " + widg, ind,
                                              dicpack)
            #inserertreeview("Container Frame ",ind,dicpack)
            CodePython.ecritdata(ind, Frame, parent, dicopt)
            CodePython.ecritpack(ind, dicpack)

            fr = creewidget(Frame, dictwidg[parent], ind, dicopt)
            fr.pack(dicpack)