Ejemplo n.º 1
0
class Zone:
    def __init__(self, image, initialField, initialText):
        frm = Frame(root)
        frm.config(background="white")
        self.image = PhotoImage(format="gif", data=images[image.upper()])
        self.imageDimmed = PhotoImage(format="gif", data=images[image])
        self.img = Label(frm)
        self.img.config(borderwidth=0)
        self.img.pack(side="left")
        self.fld = Text(frm, **fieldParams)
        self.initScrollText(frm, self.fld, initialField)
        frm = Frame(root)
        self.txt = Text(frm, **textParams)
        self.initScrollText(frm, self.txt, initialText)
        for i in range(2):
            self.txt.tag_config(colors[i], background=colors[i])
            self.txt.tag_config("emph" + colors[i], foreground=emphColors[i])

    def initScrollText(self, frm, txt, contents):
        scl = Scrollbar(frm)
        scl.config(command=txt.yview)
        scl.pack(side="right", fill="y")
        txt.pack(side="left", expand=True, fill="x")
        txt.config(yscrollcommand=scl.set)
        txt.insert("1.0", contents)
        frm.pack(fill="x")
        Frame(height=2, bd=1, relief="ridge").pack(fill="x")

    def refresh(self):
        self.colorCycle = itertools.cycle(colors)
        try:
            self.substitute()
            self.img.config(image=self.image)
        except re.error:
            self.img.config(image=self.imageDimmed)
Ejemplo n.º 2
0
class Zone:
    def __init__(self, image, initialField, initialText):
        frm = Frame(root)
        frm.config(background="white")
        self.image = PhotoImage(format='gif',data=images[image.upper()])
        self.imageDimmed = PhotoImage(format='gif',data=images[image])
        self.img = Label(frm)
        self.img.config(borderwidth=0)
        self.img.pack(side = "left")
        self.fld = Text(frm, **fieldParams)
        self.initScrollText(frm,self.fld,initialField)
        frm = Frame(root)
        self.txt = Text(frm, **textParams)
        self.initScrollText(frm,self.txt,initialText)
        for i in range(2):
            self.txt.tag_config(colors[i], background = colors[i])
            self.txt.tag_config("emph"+colors[i], foreground = emphColors[i])
    def initScrollText(self,frm,txt,contents):
        scl = Scrollbar(frm)
        scl.config(command = txt.yview)
        scl.pack(side="right",fill="y")
        txt.pack(side = "left", expand=True, fill="x")
        txt.config(yscrollcommand = scl.set)
        txt.insert("1.0",contents)
        frm.pack(fill = "x")
        Frame(height=2, bd=1, relief="ridge").pack(fill="x")
    def refresh(self):
        self.colorCycle = itertools.cycle(colors)
        try:
            self.substitute()
            self.img.config(image = self.image)
        except re.error:
            self.img.config(image = self.imageDimmed)
Ejemplo n.º 3
0
 def on_var_changed(self, *args):
     Label.config(self, text = self.text_var.get())