Beispiel #1
0
 def __init__(
     self,
     rootWin=None,
     orientation="horizontal",
     min_=0,
     max_=100,
     width=100,
     height=18,
     appearance="sunken",
     fillColor="blue",
     background="gray",
     labelColor="yellow",
     labelFont="Verdana",
     labelFormat="%d%%",
     value=0,
     bd=2,
 ):
     # preserve various values
     self.rootWin = rootWin
     self.orientation = orientation
     self.min = min_
     self.max = max_
     self.width = width
     self.height = height
     self.fillColor = fillColor
     self.labelFont = labelFont
     self.labelColor = labelColor
     self.background = background
     self.labelFormat = labelFormat
     self.value = value
     tix.Frame.__init__(self, rootWin, relief=appearance, bd=bd)
     self.canvas = tix.Canvas(
         self,
         height=height,
         width=width,
         bd=0,
         highlightthickness=0,
         background=background,
     )
     self.scale = self.canvas.create_rectangle(
         0,
         0,
         width,
         height,
         fill=fillColor,
     )
     self.label = self.canvas.create_text(
         width / 2,
         height / 2,
         text="",
         anchor="c",
         fill=labelColor,
         font=self.labelFont,
     )
     self.update()
     self.bind("<Configure>", self.update)
     self.canvas.pack(side="top", fill="x", expand="no")
Beispiel #2
0
 def __init__(
     self,
     master=None,
     orientation='horizontal',
     min_=0,
     max_=100,
     width=100,
     height=18,
     appearance='sunken',
     fillColor='blue',
     background='gray',
     labelColor='yellow',
     labelFont='Verdana',
     labelFormat='%d%%',
     value=0,
     bd=2,
 ):
     # preserve various values
     self.master = master
     self.orientation = orientation
     self.min = min_
     self.max = max_
     self.width = width
     self.height = height
     self.fillColor = fillColor
     self.labelFont = labelFont
     self.labelColor = labelColor
     self.background = background
     self.labelFormat = labelFormat
     self.value = value
     tix.Frame.__init__(self, master, relief=appearance, bd=bd)
     self.canvas = tix.Canvas(
         self,
         height=height,
         width=width,
         bd=0,
         highlightthickness=0,
         background=background,
     )
     self.scale = self.canvas.create_rectangle(
         0,
         0,
         width,
         height,
         fill=fillColor,
     )
     self.label = self.canvas.create_text(
         width / 2,
         height / 2,
         text='',
         anchor='c',
         fill=labelColor,
         font=self.labelFont,
     )
     self.update()
     self.bind('<Configure>', self.update)
     self.canvas.pack(side='top', fill='x', expand='no')
Beispiel #3
0
 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
Beispiel #4
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()
Beispiel #5
0
#MALE - Used for defining male castes in TEMPLATE:CASTE - LINK
#FEMALE - Used for defining female castes in TEMPLATE:CASTE - LINK
#DESC - Used to fill in the creature description when creating raws, very little use for this as the script currently creates a description for each caste already
#NAME - Used to fill the the creatue name when creating raws, very useful, allows for naming of things directly in the templates
#ARG1, #ARG2, #ARG3, etc... - Used to fill in the arguments provided in TEMPLATE - ARGS
#SWIMMING_GAITS - If this tag is present in a creature (no matter which template the creature recieved it from) will alter the gaits, flipping the WALK and SWIM gaits
#ONLY_SWIMMING - Same effect as above, but removes all other gaits (WALK, CLIMB, CRAWL, FLY)
#FLYING_GAITS - If this tag is present in a creature (no matter which template the creature recieved it from) will alter the gaits, moving WALK to FLY and CRAWL to WALK
#ONLY_FLYING - Same effect as above, but removes all other gaits (WALK, CLIMB, CRAWL, SWIM)
#NOARMS - Removes the CLIMB gait
#NOLEGS - Removes the WALK gait

if __name__ == '__main__':
    root = tix.Tk()

    canvas = tix.Canvas(root, width=1000, height=600)
    canvas.grid(row=0, column=0, sticky=N + S + E + W)
    root.grid_rowconfigure(0, weight=1)

    frame = tix.Frame(canvas)
    frame.rowconfigure(1, weight=1)
    frame.columnconfigure(1, weight=1)

    class checkWindow:
        def __init__(self, ty):
            self.t = Toplevel(root)
            self.ty = ty
            self.makelist()

        def close(self):
            self.t.destroy()