예제 #1
0
            if ang > self.maxAng:
                ang = self.maxAng
            elif ang < self.minAng:
                ang = self.minAng

        radialPixPerDeg = float(self.endRad - self.begRad) / (self.endAng - self.begAng)
        radPix = self.begRad + (radialPixPerDeg * (ang - self.begAng))

        adjAng = (ang * self.angScale) + self.angOff
        xPos = self.xctr + (radPix * RO.MathUtil.cosd(adjAng))
        yPos = self.yctr - (radPix * RO.MathUtil.sind(adjAng))
        return (xPos, yPos)

if __name__ == '__main__':
    from RO.Wdg.PythonTk import PythonTk
    root = PythonTk()

    cnv = tkinter.Canvas (root, width=201, height=201)
    cnv.pack()
    ctrPlus  (cnv,  80,  80, 10, 5)
    ctrPlus  (cnv, 100,  80, 10, 5, 5)
    ctrX     (cnv,  80, 100, 10, 5)
    ctrX     (cnv, 100, 100, 10, 5, 5)
    ctrCircle(cnv,  80, 120, 10, 1)
    ctrCircle(cnv, 100, 120, 10, 5)

    ctrCircle(cnv, 120,  80, 10)
    ctrPlus  (cnv, 120,  80, 10, holeRad = 5)
    ctrX     (cnv, 120,  80, 10, holeRad = 5)
    
    ctrCircle(cnv, 120, 100, 10, width = 5)
예제 #2
0
                if doSaveState:
                    valueList.append(json.dumps(currState))

                # comment out entry if all values are default
                if isDefaultGeom and isDefaultVis and isDefaultState:
                    prefixStr = "# "
                else:
                    prefixStr = ""
                outFile.write("%s%s = %s\n" %
                              (prefixStr, name, ", ".join(valueList)))
        finally:
            outFile.close()

if __name__ == "__main__":
    from RO.Wdg.PythonTk import PythonTk
    root = PythonTk()

    testWin = Toplevel(title="test window",
                       resizable=(False, True),
                       geometry="40x40+150+50")
    l = tkinter.Label(testWin, text="This is a label")
    l.pack()

    def printInfo():
        print("testWin.getGeometry = %r" % (testWin.getGeometry(), ))
        print("geometry = %r" % (testWin.geometry()))
        print("width, height = %r, %r" %
              (testWin.winfo_width(), testWin.winfo_height()))
        print("req width, req height = %r, %r" %
              (testWin.winfo_reqwidth(), testWin.winfo_reqheight()))
        print("")
예제 #3
0
파일: Text.py 프로젝트: goodeveryone/awsl
            self.configure(
                background=self._prefDict["Bad Background"].getValue())

    def _updateStateTagColors(self, *args):
        """Update the colors for tags RO.Constants.sevNormal, sevWarning and sevError.
        Ignored unless useStateTags True at instantiation.
        """
        for state in (RO.Constants.sevWarning, RO.Constants.sevError):
            self.tag_configure(state,
                               color=self._sevPrefDict[state].getValue())


if __name__ == "__main__":
    from RO.Wdg.PythonTk import PythonTk
    import StatusBar
    root = PythonTk()

    text1 = Text(root, "text widget", height=5, width=20)
    text2 = Text(root,
                 readOnly=True,
                 helpText="read only text widget",
                 height=5,
                 width=20)
    statusBar = StatusBar.StatusBar(root)
    text1.grid(row=0, column=0, sticky="nsew")
    text2.grid(row=1, column=0, sticky="nsew")
    statusBar.grid(row=2, column=0, sticky="ew")
    root.grid_rowconfigure(0, weight=1)
    root.grid_rowconfigure(1, weight=1)
    root.grid_columnconfigure(0, weight=1)
예제 #4
0
파일: Text.py 프로젝트: astromaddie/RO-py3
            self.configure(background=self._prefDict["Background Color"].getValue())
        else:
            self.configure(background=self._prefDict["Bad Background"].getValue())

    def _updateStateTagColors(self, *args):
        """Update the colors for tags RO.Constants.sevNormal, sevWarning and sevError.
        Ignored unless useStateTags True at instantiation.
        """
        for state in (RO.Constants.sevWarning, RO.Constants.sevError):
            self.tag_configure(state, color = self._sevPrefDict[state].getValue())


if __name__ == "__main__":
    from RO.Wdg.PythonTk import PythonTk
    from . import StatusBar
    root = PythonTk()

    text1 = Text(root, "text widget", height=5, width=20)
    text2 = Text(root, readOnly=True, helpText = "read only text widget",  height=5, width=20)  
    statusBar = StatusBar.StatusBar(root)
    text1.grid(row=0, column=0, sticky="nsew")
    text2.grid(row=1, column=0, sticky="nsew")
    statusBar.grid(row=2, column=0, sticky="ew")
    root.grid_rowconfigure(0, weight=1)
    root.grid_rowconfigure(1, weight=1)
    root.grid_columnconfigure(0, weight=1)
    
    text1.insert("end", "this is an editable text widget\n")
    text2.insert("end", "this is a read-only text widget\n")

    root.mainloop()