• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tkinter.Tcl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tkinter.Tk类代码示例发布时间:2022-05-27
下一篇:
Python tkinter.StringVar类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap