当前位置: 首页>>代码示例>>Python>>正文


Python tkinter.Tcl类代码示例

本文整理汇总了Python中tkinter.Tcl的典型用法代码示例。如果您正苦于以下问题:Python Tcl类的具体用法?Python Tcl怎么用?Python Tcl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tcl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_tk_patchlevel

def get_tk_patchlevel():
    global _tk_patchlevel
    if _tk_patchlevel is None:
        tcl = Tcl()
        patchlevel = []
        for x in tcl.call('info', 'patchlevel').split('.'):
            try:
                x = int(x, 10)
            except ValueError:
                x = -1
            patchlevel.append(x)
        _tk_patchlevel = tuple(patchlevel)
    return _tk_patchlevel
开发者ID:IgnusIndia,项目名称:pythonexperiment,代码行数:13,代码来源:test_tcl.py

示例2: get_tk_patchlevel

def get_tk_patchlevel():
    global _tk_patchlevel
    if _tk_patchlevel is None:
        tcl = Tcl()
        patchlevel = tcl.call('info', 'patchlevel')
        m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', patchlevel)
        major, minor, releaselevel, serial = m.groups()
        major, minor, serial = int(major), int(minor), int(serial)
        releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel]
        if releaselevel == 'final':
            _tk_patchlevel = major, minor, serial, releaselevel, 0
        else:
            _tk_patchlevel = major, minor, 0, releaselevel, serial
    return _tk_patchlevel
开发者ID:ARK4579,项目名称:cpython,代码行数:14,代码来源:test_tcl.py

示例3: testLoadTk

 def testLoadTk(self):
     import os
     if 'DISPLAY' not in os.environ:
         # skipping test of clean upgradeability
         return
     tcl = Tcl()
     self.assertRaises(TclError,tcl.winfo_geometry)
     tcl.loadtk()
     self.assertEqual('1x1+0+0', tcl.winfo_geometry())
     tcl.destroy()
开发者ID:LinkedModernismProject,项目名称:web_code,代码行数:10,代码来源:test_tcl.py

示例4: __check_enviroment

    def __check_enviroment(self):
        try:
            self.py_Version = platform.python_version()
            self.py_Compiler = platform.python_compiler()
            self.py_Build = platform.python_build()

            major, minor, patch = self.py_Version.split(".")
            if (int(major) < MIN_PY_MAJOR_VERSION) or (
                (int(major) == MIN_PY_MAJOR_VERSION) and (int(minor) < MIN_PY_MINOR_VERSION)
            ):
                raise Exception(
                    "Python Version " + MIN_TCL_MAJOR_VERSION + "." + MIN_TCL_MINOR_VERSION + ".x or higher required"
                )

            self.tcl_Version = Tcl().eval("info patchlevel")
            major, minor, patch = self.tcl_Version.split(".")
            if (int(major) < MIN_TCL_MAJOR_VERSION) or (
                (int(major) == MIN_TCL_MAJOR_VERSION) and (int(minor) < MIN_TCL_MINOR_VERSION)
            ):
                raise Exception(
                    "TCL Version " + MIN_TCL_MAJOR_VERSION + "." + MIN_TCL_MINOR_VERSION + ".x or higher required"
                )
        except:
            raise
开发者ID:UHF,项目名称:ExtPtcGate,代码行数:24,代码来源:c_mainFrame.py

示例5: setUpModule

def setUpModule():
    if support.verbose:
        tcl = Tcl()
        print('patchlevel =', tcl.call('info', 'patchlevel'))
开发者ID:IgnusIndia,项目名称:pythonexperiment,代码行数:4,代码来源:test_tcl.py

示例6: setUp

 def setUp(self):
     self.interp = Tcl()
     self.wantobjects = self.interp.tk.wantobjects()
开发者ID:IgnusIndia,项目名称:pythonexperiment,代码行数:3,代码来源:test_tcl.py

示例7: TclTest

class TclTest(unittest.TestCase):

    def setUp(self):
        self.interp = Tcl()
        self.wantobjects = self.interp.tk.wantobjects()

    def testEval(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.eval('set a'),'1')

    def test_eval_null_in_result(self):
        tcl = self.interp
        self.assertEqual(tcl.eval('set a "a\\0b"'), 'a\x00b')

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'set a')

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'this is wrong')

    def testCall(self):
        tcl = self.interp
        tcl.call('set','a','1')
        self.assertEqual(tcl.call('set','a'),'1')

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'set','a')

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'this','is','wrong')

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar('a','1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)','1')
        self.assertEqual(tcl.eval('set a(1)'),'1')

    def testGetVar(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.getvar('a'),'1')

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval('set a(1) 1')
        self.assertEqual(tcl.getvar('a(1)'),'1')

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a')

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a(1)')

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar('a',1)
        self.assertEqual(tcl.eval('info exists a'),'1')
        tcl.unsetvar('a')
        self.assertEqual(tcl.eval('info exists a'),'0')

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)',1)
        tcl.setvar('a(2)',2)
        self.assertEqual(tcl.eval('info exists a(1)'),'1')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')
        tcl.unsetvar('a(1)')
        self.assertEqual(tcl.eval('info exists a(1)'),'0')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.unsetvar,'a')

    def testEvalFile(self):
        tcl = self.interp
        with open(support.TESTFN, 'w') as f:
            self.addCleanup(support.unlink, support.TESTFN)
            f.write("""set a 1
            set b 2
            set c [ expr $a + $b ]
            """)
        tcl.evalfile(support.TESTFN)
        self.assertEqual(tcl.eval('set a'),'1')
        self.assertEqual(tcl.eval('set b'),'2')
        self.assertEqual(tcl.eval('set c'),'3')

    def test_evalfile_null_in_result(self):
        tcl = self.interp
#.........这里部分代码省略.........
开发者ID:IgnusIndia,项目名称:pythonexperiment,代码行数:101,代码来源:test_tcl.py

示例8: TclTest

class TclTest(unittest.TestCase):

    def setUp(self):
        self.interp = Tcl()
        self.wantobjects = self.interp.tk.wantobjects()

    def testEval(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.eval('set a'),'1')

    def test_eval_null_in_result(self):
        tcl = self.interp
        self.assertEqual(tcl.eval('set a "a\\0b"'), 'a\x00b')

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'set a')

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'this is wrong')

    def testCall(self):
        tcl = self.interp
        tcl.call('set','a','1')
        self.assertEqual(tcl.call('set','a'),'1')

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'set','a')

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'this','is','wrong')

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar('a','1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)','1')
        self.assertEqual(tcl.eval('set a(1)'),'1')

    def testGetVar(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.getvar('a'),'1')

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval('set a(1) 1')
        self.assertEqual(tcl.getvar('a(1)'),'1')

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a')

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a(1)')

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar('a',1)
        self.assertEqual(tcl.eval('info exists a'),'1')
        tcl.unsetvar('a')
        self.assertEqual(tcl.eval('info exists a'),'0')

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)',1)
        tcl.setvar('a(2)',2)
        self.assertEqual(tcl.eval('info exists a(1)'),'1')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')
        tcl.unsetvar('a(1)')
        self.assertEqual(tcl.eval('info exists a(1)'),'0')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.unsetvar,'a')

    def get_integers(self):
        integers = (0, 1, -1, 2**31-1, -2**31, 2**31, -2**31-1, 2**63-1, -2**63)
        # bignum was added in Tcl 8.5, but its support is able only since 8.5.8
        if (get_tk_patchlevel() >= (8, 6, 0, 'final') or
            (8, 5, 8) <= get_tk_patchlevel() < (8, 6)):
            integers += (2**63, -2**63-1, 2**1000, -2**1000)
        return integers

    def test_getint(self):
        tcl = self.interp.tk
        for i in self.get_integers():
            self.assertEqual(tcl.getint(' %d ' % i), i)
            if tcl_version >= (8, 5):
                self.assertEqual(tcl.getint(' %#o ' % i), i)
            self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), i)
#.........这里部分代码省略.........
开发者ID:ARK4579,项目名称:cpython,代码行数:101,代码来源:test_tcl.py

示例9: testLoadTk

 def testLoadTk(self):
     tcl = Tcl()
     self.assertRaises(TclError,tcl.winfo_geometry)
     tcl.loadtk()
     self.assertEqual('1x1+0+0', tcl.winfo_geometry())
     tcl.destroy()
开发者ID:5outh,项目名称:Databases-Fall2014,代码行数:6,代码来源:test_loadtk.py

示例10: TclTest

class TclTest(unittest.TestCase):
    def setUp(self):
        self.interp = Tcl()
        self.wantobjects = self.interp.tk.wantobjects()

    def testEval(self):
        tcl = self.interp
        tcl.eval("set a 1")
        self.assertEqual(tcl.eval("set a"), "1")

    def test_eval_null_in_result(self):
        tcl = self.interp
        self.assertEqual(tcl.eval('set a "a\\0b"'), "a\x00b")

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.eval, "set a")

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.eval, "this is wrong")

    def testCall(self):
        tcl = self.interp
        tcl.call("set", "a", "1")
        self.assertEqual(tcl.call("set", "a"), "1")

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.call, "set", "a")

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.call, "this", "is", "wrong")

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar("a", "1")
        self.assertEqual(tcl.eval("set a"), "1")

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar("a(1)", "1")
        self.assertEqual(tcl.eval("set a(1)"), "1")

    def testGetVar(self):
        tcl = self.interp
        tcl.eval("set a 1")
        self.assertEqual(tcl.getvar("a"), "1")

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval("set a(1) 1")
        self.assertEqual(tcl.getvar("a(1)"), "1")

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.getvar, "a")

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.getvar, "a(1)")

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar("a", 1)
        self.assertEqual(tcl.eval("info exists a"), "1")
        tcl.unsetvar("a")
        self.assertEqual(tcl.eval("info exists a"), "0")

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar("a(1)", 1)
        tcl.setvar("a(2)", 2)
        self.assertEqual(tcl.eval("info exists a(1)"), "1")
        self.assertEqual(tcl.eval("info exists a(2)"), "1")
        tcl.unsetvar("a(1)")
        self.assertEqual(tcl.eval("info exists a(1)"), "0")
        self.assertEqual(tcl.eval("info exists a(2)"), "1")

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.unsetvar, "a")

    def testEvalFile(self):
        tcl = self.interp
        with open(support.TESTFN, "w") as f:
            self.addCleanup(support.unlink, support.TESTFN)
            f.write(
                """set a 1
            set b 2
            set c [ expr $a + $b ]
            """
            )
        tcl.evalfile(support.TESTFN)
        self.assertEqual(tcl.eval("set a"), "1")
        self.assertEqual(tcl.eval("set b"), "2")
        self.assertEqual(tcl.eval("set c"), "3")

    def test_evalfile_null_in_result(self):
#.........这里部分代码省略.........
开发者ID:TheYear2015,项目名称:TextWorldEditor,代码行数:101,代码来源:test_tcl.py

示例11: setUp

 def setUp(self):
     self.interp = Tcl()
开发者ID:jadore,项目名称:cpython,代码行数:2,代码来源:test_tcl.py

示例12: TclTest

class TclTest(unittest.TestCase):

    def setUp(self):
        self.interp = Tcl()

    def testEval(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'set a')

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'this is wrong')

    def testCall(self):
        tcl = self.interp
        tcl.call('set','a','1')
        self.assertEqual(tcl.call('set','a'),'1')

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'set','a')

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'this','is','wrong')

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar('a','1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)','1')
        self.assertEqual(tcl.eval('set a(1)'),'1')

    def testGetVar(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.getvar('a'),'1')

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval('set a(1) 1')
        self.assertEqual(tcl.getvar('a(1)'),'1')

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a')

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a(1)')

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar('a',1)
        self.assertEqual(tcl.eval('info exists a'),'1')
        tcl.unsetvar('a')
        self.assertEqual(tcl.eval('info exists a'),'0')

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)',1)
        tcl.setvar('a(2)',2)
        self.assertEqual(tcl.eval('info exists a(1)'),'1')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')
        tcl.unsetvar('a(1)')
        self.assertEqual(tcl.eval('info exists a(1)'),'0')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.unsetvar,'a')

    def testEvalFile(self):
        tcl = self.interp
        filename = "testEvalFile.tcl"
        fd = open(filename,'w')
        script = """set a 1
        set b 2
        set c [ expr $a + $b ]
        """
        fd.write(script)
        fd.close()
        tcl.evalfile(filename)
        os.remove(filename)
        self.assertEqual(tcl.eval('set a'),'1')
        self.assertEqual(tcl.eval('set b'),'2')
        self.assertEqual(tcl.eval('set c'),'3')

    def testEvalFileException(self):
        tcl = self.interp
        filename = "doesnotexists"
        try:
#.........这里部分代码省略.........
开发者ID:jadore,项目名称:cpython,代码行数:101,代码来源:test_tcl.py

示例13: TclTest

class TclTest(unittest.TestCase):

    def setUp(self):
        self.interp = Tcl()
        self.wantobjects = self.interp.tk.wantobjects()

    def testEval(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'set a')

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.eval,'this is wrong')

    def testCall(self):
        tcl = self.interp
        tcl.call('set','a','1')
        self.assertEqual(tcl.call('set','a'),'1')

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'set','a')

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.call,'this','is','wrong')

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar('a','1')
        self.assertEqual(tcl.eval('set a'),'1')

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)','1')
        self.assertEqual(tcl.eval('set a(1)'),'1')

    def testGetVar(self):
        tcl = self.interp
        tcl.eval('set a 1')
        self.assertEqual(tcl.getvar('a'),'1')

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval('set a(1) 1')
        self.assertEqual(tcl.getvar('a(1)'),'1')

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a')

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.getvar,'a(1)')

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar('a',1)
        self.assertEqual(tcl.eval('info exists a'),'1')
        tcl.unsetvar('a')
        self.assertEqual(tcl.eval('info exists a'),'0')

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar('a(1)',1)
        tcl.setvar('a(2)',2)
        self.assertEqual(tcl.eval('info exists a(1)'),'1')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')
        tcl.unsetvar('a(1)')
        self.assertEqual(tcl.eval('info exists a(1)'),'0')
        self.assertEqual(tcl.eval('info exists a(2)'),'1')

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError,tcl.unsetvar,'a')

    def testEvalFile(self):
        tcl = self.interp
        filename = "testEvalFile.tcl"
        fd = open(filename,'w')
        script = """set a 1
        set b 2
        set c [ expr $a + $b ]
        """
        fd.write(script)
        fd.close()
        tcl.evalfile(filename)
        os.remove(filename)
        self.assertEqual(tcl.eval('set a'),'1')
        self.assertEqual(tcl.eval('set b'),'2')
        self.assertEqual(tcl.eval('set c'),'3')

    def testEvalFileException(self):
        tcl = self.interp
        filename = "doesnotexists"
#.........这里部分代码省略.........
开发者ID:pykomke,项目名称:Kurz_Python_KE,代码行数:101,代码来源:test_tcl.py

示例14: TclTest

class TclTest(unittest.TestCase):
    def setUp(self):
        self.interp = Tcl()

    def testEval(self):
        tcl = self.interp
        tcl.eval("set a 1")
        self.assertEqual(tcl.eval("set a"), "1")

    def testEvalException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.eval, "set a")

    def testEvalException2(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.eval, "this is wrong")

    def testCall(self):
        tcl = self.interp
        tcl.call("set", "a", "1")
        self.assertEqual(tcl.call("set", "a"), "1")

    def testCallException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.call, "set", "a")

    def testCallException2(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.call, "this", "is", "wrong")

    def testSetVar(self):
        tcl = self.interp
        tcl.setvar("a", "1")
        self.assertEqual(tcl.eval("set a"), "1")

    def testSetVarArray(self):
        tcl = self.interp
        tcl.setvar("a(1)", "1")
        self.assertEqual(tcl.eval("set a(1)"), "1")

    def testGetVar(self):
        tcl = self.interp
        tcl.eval("set a 1")
        self.assertEqual(tcl.getvar("a"), "1")

    def testGetVarArray(self):
        tcl = self.interp
        tcl.eval("set a(1) 1")
        self.assertEqual(tcl.getvar("a(1)"), "1")

    def testGetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.getvar, "a")

    def testGetVarArrayException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.getvar, "a(1)")

    def testUnsetVar(self):
        tcl = self.interp
        tcl.setvar("a", 1)
        self.assertEqual(tcl.eval("info exists a"), "1")
        tcl.unsetvar("a")
        self.assertEqual(tcl.eval("info exists a"), "0")

    def testUnsetVarArray(self):
        tcl = self.interp
        tcl.setvar("a(1)", 1)
        tcl.setvar("a(2)", 2)
        self.assertEqual(tcl.eval("info exists a(1)"), "1")
        self.assertEqual(tcl.eval("info exists a(2)"), "1")
        tcl.unsetvar("a(1)")
        self.assertEqual(tcl.eval("info exists a(1)"), "0")
        self.assertEqual(tcl.eval("info exists a(2)"), "1")

    def testUnsetVarException(self):
        tcl = self.interp
        self.assertRaises(TclError, tcl.unsetvar, "a")

    def testEvalFile(self):
        tcl = self.interp
        filename = "testEvalFile.tcl"
        fd = open(filename, "w")
        script = """set a 1
        set b 2
        set c [ expr $a + $b ]
        """
        fd.write(script)
        fd.close()
        tcl.evalfile(filename)
        os.remove(filename)
        self.assertEqual(tcl.eval("set a"), "1")
        self.assertEqual(tcl.eval("set b"), "2")
        self.assertEqual(tcl.eval("set c"), "3")

    def testEvalFileException(self):
        tcl = self.interp
        filename = "doesnotexists"
        try:
            os.remove(filename)
#.........这里部分代码省略.........
开发者ID:mshmoustafa,项目名称:static-python,代码行数:101,代码来源:test_tcl.py

示例15: c_mainFrame

class c_mainFrame(Tk):
    """
    classdocs
    """

    def __init__(self, **paras):
        """
        Constructor
        """
        try:
            super().__init__(**paras)

            self.__check_enviroment()
            self.system = self.tk.call("tk", "windowingsystem")

            self.__mystyle()
            self.__setup()
            self.__create_children()
            pass
        except:
            raise
        else:
            pass

    def __del__(self):
        try:
            pass
        except:
            pass
        else:
            pass

    def __check_enviroment(self):
        try:
            self.py_Version = platform.python_version()
            self.py_Compiler = platform.python_compiler()
            self.py_Build = platform.python_build()

            major, minor, patch = self.py_Version.split(".")
            if (int(major) < MIN_PY_MAJOR_VERSION) or (
                (int(major) == MIN_PY_MAJOR_VERSION) and (int(minor) < MIN_PY_MINOR_VERSION)
            ):
                raise Exception(
                    "Python Version " + MIN_TCL_MAJOR_VERSION + "." + MIN_TCL_MINOR_VERSION + ".x or higher required"
                )

            self.tcl_Version = Tcl().eval("info patchlevel")
            major, minor, patch = self.tcl_Version.split(".")
            if (int(major) < MIN_TCL_MAJOR_VERSION) or (
                (int(major) == MIN_TCL_MAJOR_VERSION) and (int(minor) < MIN_TCL_MINOR_VERSION)
            ):
                raise Exception(
                    "TCL Version " + MIN_TCL_MAJOR_VERSION + "." + MIN_TCL_MINOR_VERSION + ".x or higher required"
                )
        except:
            raise

    def __setup(self):
        try:
            self.option_add("*tearOFF", FALSE)
            self.geometry("1024x640+10+10")
            self.configure(title="Extended PTC Gateway")

            pass
        except:
            pass
        else:
            pass

    def __create_children(self):
        try:
            self.__create_menue()
            pass
        except:
            raise
        else:
            pass

    def __create_menue(self):
        try:
            self.frm_menu = ttk.Frame(self, name="menu")

            ttk.Button(self.frm_menu, name="btn_new_file", text="New", command=self.__on_menu_new_file).pack(side=LEFT)
            ttk.Button(self.frm_menu, name="btn_open_file", text="Open", command=self.__on_menu_open_file).pack(
                side=LEFT
            )
            ttk.Button(
                self.frm_menu, name="btn_save_file", text="Save", state="disabled", command=self.__on_menu_save_file
            ).pack(side=LEFT)
            ttk.Button(
                self.frm_menu,
                name="btn_save_as_file",
                text="SaveAs",
                state="disabled",
                command=self.__on_menu_save_as_file,
            ).pack(side=LEFT)

            self.frm_menu.pack(side=TOP, fill=X)
            pass
        except:
#.........这里部分代码省略.........
开发者ID:UHF,项目名称:ExtPtcGate,代码行数:101,代码来源:c_mainFrame.py


注:本文中的tkinter.Tcl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。