Ejemplo n.º 1
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)
Ejemplo n.º 2
0
 def makelist(self):
     stext = tix.ScrolledText(self.t, width=800, height=1000)
     stext.subwidget('text').insert(tix.INSERT,
                                    '\n'.join(rcc.creature['Raws']))
     stext.grid(row=0, column=0)
     self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
     self.bb.add('close', text='Close', command=self.close)
     self.bb.grid(row=0, column=1)
Ejemplo n.º 3
0
def btnDialog(w):
    btn_box = tix.ButtonBox(w, orientation=tix.HORIZONTAL)
    btn_box.add('hello',
                text='确认',
                underline=0,
                width=5,
                command=lambda w=w: w.destroy())
    btn_box.add('close',
                text='取消',
                underline=0,
                width=5,
                command=lambda w=w: w.destroy())
    btn_box.pack(side=tix.BOTTOM, fill=tix.X)
Ejemplo n.º 4
0
def btnDialog(w):  #自定义按钮对话框函数
    bbox = tix.ButtonBox(w, orientation=tix.HORIZONTAL)  #创建水平的ButtonBox实例
    bbox.add(
        'ok',
        text='确认',
        underline=0,
        width=5,  #增加“确认”按钮
        command=lambda w=w: w.destroy())  #带窗体关闭功能
    bbox.add(
        'close',
        text='取消',
        underline=0,
        width=5,  #增加“取消”按钮
        command=lambda w=w: w.destroy())  #带窗体关闭功能
    bbox.pack(side=tix.BOTTOM, fill=tix.X)  #bbox对象在窗体上的定位
Ejemplo n.º 5
0
        def makelist(self):
            speedBalloon = tix.Balloon(self.t)

            variable = {}
            var_variables = ['percent']
            temp = rcc.variability
            temp.sort()
            labels = {}
            bLabel = tix.Label(
                self.t,
                text=
                'Variability level between individual animals of the same creature\nPercent is assumed to be maximum variability\nIf 0 the BODY_APPEARANCE_MODIFIER tags will not be added'
            )
            r = 0
            c = 1
            for key in temp:
                r = r + 1
                variable[key] = {}
                if r > 12:
                    c = c + 1
                    r = 1
                labels[key] = tix.Label(self.t, text=key.capitalize() +
                                        ':').grid(row=r, column=c, stick=tix.W)
                for var in var_variables:
                    r = r + 1
                    variable[key][var] = tix.Control(
                        self.t,
                        label=var.capitalize(),
                        min=0,
                        value=rcc.numbers['variable'][key][var].get(),
                        variable=rcc.numbers['variable'][key][var],
                        autorepeat=False)
                    variable[key][var].subwidget('decr').destroy()
                    variable[key][var].subwidget('incr').destroy()
                    variable[key][var].grid(row=r,
                                            column=c,
                                            stick=tix.E,
                                            padx=10)

            bLabel.grid(row=0, column=0, columnspan=c)
            self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
            self.bb.add('close', text='Close', command=self.close)
            self.bb.grid(row=0, column=c + 1)
Ejemplo n.º 6
0
        def makelist(self):
            listBalloon = tix.Balloon(self.t)
            c = 0
            self.cl = {}
            for type1 in rcc.checks[self.ty]:
                j = 0
                self.cl[type1] = tix.CheckList(self.t,
                                               width=350,
                                               height=600,
                                               browsecmd=self.update)
                self.cl[type1].grid(row=0, column=c)
                self.cl[type1].hlist.add(type1, text=type1)
                self.cl[type1].setstatus(type1, rcc.status[type1]['All'])
                temp = list(rcc.data[type1].keys())
                temp.sort()
                for subtype in temp:
                    j = j + 1
                    hl = tix.Label(self.cl[type1], text="?")
                    hl.place(in_=self.cl[type1],
                             x=10,
                             y=16 * j + 4,
                             width=10,
                             height=10)
                    #     hl.place_forget()
                    self.cl[type1].hlist.add(type1 + '.' + subtype,
                                             text=subtype)
                    self.cl[type1].setstatus(type1 + '.' + subtype,
                                             rcc.status[type1][subtype])
                    #     print(self.cl[type].subwidgets_all())
                    listBalloon.bind_widget(hl,
                                            msg=''.join(
                                                rcc.store[type1][subtype]))
#     hl.place_forget()
                self.cl[type1].autosetmode()
                c = c + 1
            self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
            self.bb.add('close', text='Close', command=self.close)
            self.bb.add('check', text='Check All', command=self.checkAll)
            self.bb.add('uncheck', text='Uncheck All', command=self.uncheckAll)
            self.bb.grid(row=0, column=c)
Ejemplo n.º 7
0
        def makelist(self):
            speedBalloon = tix.Balloon(self.t)

            speed = {}
            speed_variables = ['max', 'min']
            temp = rcc.gaits
            temp.sort()
            labels = {}
            bLabel = tix.Label(
                self.t,
                text=
                'Speed of various gaits in kph\nChosen from a triangular distribution between Min and Max\nSee the readme for additional information'
            )
            r = 0
            c = 1
            for key in temp:
                r = r + 1
                speed[key] = {}
                if r > 12:
                    c = c + 1
                    r = 1
                labels[key] = tix.Label(self.t, text=key.capitalize() +
                                        ':').grid(row=r, column=c, stick=tix.W)
                for var in speed_variables:
                    r = r + 1
                    speed[key][var] = tix.Control(
                        self.t,
                        label=var.capitalize(),
                        min=0,
                        value=rcc.numbers['speed'][key][var].get(),
                        variable=rcc.numbers['speed'][key][var],
                        autorepeat=False)
                    speed[key][var].subwidget('decr').destroy()
                    speed[key][var].subwidget('incr').destroy()
                    speed[key][var].grid(row=r, column=c, stick=tix.E, padx=10)

            bLabel.grid(row=0, column=0, columnspan=c)
            self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
            self.bb.add('close', text='Close', command=self.close)
            self.bb.grid(row=0, column=c + 1)
Ejemplo n.º 8
0
        def makelist(self):
            argsBalloon = tix.Balloon(self.t)

            arg = {}
            arg_variables = ['max', 'min']
            temp = list(rcc.args.keys())
            temp.sort()
            labels = {}
            bLabel = tix.Label(
                self.t,
                text=
                'All arguments found in the Templates\nWhen each creature is generated a value is chosen for each argument\nThe value is selected from a triangular distribution between Min and Max'
            )
            r = 0
            c = 1
            for key in temp:
                r = r + 1
                arg[key] = {}
                if r > 12:
                    c = c + 1
                    r = 1
                labels[key] = tix.Label(self.t, text=key.capitalize() +
                                        ':').grid(row=r, column=c, stick=tix.W)
                for var in arg_variables:
                    r = r + 1
                    arg[key][var] = tix.Control(
                        self.t,
                        label=var.capitalize(),
                        min=0,
                        value=rcc.numbers['args'][key][var].get(),
                        variable=rcc.numbers['args'][key][var],
                        autorepeat=False)
                    arg[key][var].subwidget('decr').destroy()
                    arg[key][var].subwidget('incr').destroy()
                    arg[key][var].grid(row=r, column=c, stick=tix.E, padx=10)

            bLabel.grid(row=0, column=0, columnspan=c)
            self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
            self.bb.add('close', text='Close', command=self.close)
            self.bb.grid(row=0, column=c + 1)
Ejemplo n.º 9
0
    def buttonBox(self, parent):
        box = tix.ButtonBox(parent, orientation=tix.HORIZONTAL)

        box.add('infer',
                text='Infer',
                underline=0,
                width=6,
                command=self.onInferButton)

        box.add('infer-equiv',
                text='Infer Equivalence',
                underline=0,
                width=15,
                command=self.onInferEquivButton)

        box.add('begin',
                text='Begin',
                underline=0,
                width=6,
                command=self.onBeginButton)

        box.add('end',
                text='End',
                underline=0,
                width=6,
                command=self.onEndButton)

        box.add('del',
                text='<<',
                underline=0,
                width=6,
                command=self.deleteStep)

        box.add('close', text='Close', underline=0, width=6, command=self.quit)

        self.infer = box.infer

        box.pack(fill=tix.X)
Ejemplo n.º 10
0
        def makelist(self):
            advBalloon = tix.Balloon(self.t)
            r = 0
            c = 0
            attribute = {}
            attribute_variables = ['max', 'min', 'sigma']
            temp = rcc.phys_attributes
            temp.sort()
            labels = {}
            labels['Phys_Atts'] = tix.Label(self.t,
                                            text='Physical\nAttributes')
            labels['Phys_Atts'].grid(row=r, column=c)
            for key in temp:
                r = r + 1
                attribute[key] = {}
                labels[key] = tix.Label(self.t, text=key.capitalize() +
                                        ':').grid(row=r, column=c, stick=tix.W)
                for var in attribute_variables:
                    r = r + 1
                    attribute[key][var] = tix.Control(
                        self.t,
                        label=var.capitalize(),
                        min=0,
                        value=rcc.numbers['attributes'][key][var].get(),
                        variable=rcc.numbers['attributes'][key][var],
                        autorepeat=False)
                    attribute[key][var].subwidget('decr').destroy()
                    attribute[key][var].subwidget('incr').destroy()
                    attribute[key][var].grid(row=r,
                                             column=c,
                                             stick=tix.E,
                                             padx=10)
            advBalloon.bind_widget(
                labels['Phys_Atts'],
                msg=
                'Physical attribute tokens [PHYS_ATT_RANGE:STRENGTH:a:b:c:d:e:f:g] are calculated as follows:\n  a is taken from a gaussian distribution with mean Min and sigma Sigma\n  g is taken from a gaussian distribution with mean Max and sigma Sigma\n  d = (a+g)/2\n  c/e = d -/+ 2*(g-d)/10\n  b/f = d -/+ 5*(g-d)/10\nIf Max is 0 then the attribute token is not added to the creature'
            )

            r = 0
            c = 1
            temp = rcc.ment_attributes
            temp.sort()
            labels = {}
            for key in temp:
                r = r + 1
                if r >= 23:
                    r = 1
                    c += 1
                attribute[key] = {}
                labels[key] = tix.Label(self.t, text=key.capitalize() +
                                        ':').grid(row=r, column=c, stick=tix.W)
                for var in attribute_variables:
                    r = r + 1
                    attribute[key][var] = tix.Control(
                        self.t,
                        label=var.capitalize(),
                        min=0,
                        value=rcc.numbers['attributes'][key][var].get(),
                        variable=rcc.numbers['attributes'][key][var],
                        autorepeat=False)
                    attribute[key][var].subwidget('decr').destroy()
                    attribute[key][var].subwidget('incr').destroy()
                    attribute[key][var].grid(row=r,
                                             column=c,
                                             stick=tix.E,
                                             padx=10)
            labels['Ment_Atts'] = tix.Label(self.t, text='Mental\nAttributes')
            labels['Ment_Atts'].grid(row=0, column=1, columnspan=c)
            advBalloon.bind_widget(
                labels['Ment_Atts'],
                msg=
                'Mental attribute tokens [MENT_ATT_RANGE:WILLPOWER:a:b:c:d:e:f:g] are calculated as follows:\n  a is taken from a gaussian distribution with mean Min and sigma Sigma\n  g is taken from a gaussian distribution with mean Max and sigma Sigma\n  d = (a+g)/2\n  c/e = d -/+ 2*(g-d)/10\n  b/f = d -/+ 5*(g-d)/10\nIf Max is 0 then the attribute token is not added to the creature'
            )

            self.bb = tix.ButtonBox(self.t, orientation=tix.VERTICAL)
            self.bb.add('close', text='Close', command=self.close)
            self.bb.grid(row=0, column=c + 1)
Ejemplo n.º 11
0
    canvas.create_window(0, 0, anchor=NW, window=frame)
    frame.update_idletasks()
    canvas.config(scrollregion=canvas.bbox('all'))

    makeNumbersTable(frame)

    mainBalloon = tix.Balloon(frame)
    templateLabel = tix.Label(frame, text='Templates')
    templateLabel.grid(row=0, column=0)
    mainBalloon.bind_widget(
        templateLabel,
        msg=
        'Select which templates you wish to be considered for adding to creatures\nBy default all templates are active'
    )
    bb = tix.ButtonBox(frame, orientation=tix.VERTICAL)
    bb.add('attack', text='Attacks and Interactions', command=attacks)
    bb.add('base', text='Body Materials', command=materials)
    bb.add('body', text='Body Parts (Core)', command=bodyparts)
    bb.add('body2', text='Body Parts (Extremities)', command=bodyparts2)
    bb.add('attachments', text='Body Part Attachments', command=attachments)
    bb.add('internal', text='Organs, Bones, and Extracts', command=internal)
    bb.add('face', text='Facial Features (Large)', command=face)
    bb.add('face2', text='Facial Features (Small)', command=face2)
    bb.add('biome', text='Biomes, Types, and Castes', command=biomes)
    bb.grid(row=1, column=0)

    bb2 = tix.ButtonBox(frame, orientation=tix.HORIZONTAL)
    bb2.add('arg', text='Argument Values', command=arguments)
    bb2.add('speed', text='Gait Speeds', command=speeds)
    bb2.add('advanced', text='Attributes', command=attributes)