Python tkinter.TkVersion() Examples
The following are 10
code examples of tkinter.TkVersion().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.
Example #1
Source File: ColorDelegator.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def color_config(text): # Called from htest, Editor, and Turtle Demo. '''Set color opitons of Text widget. Should be called whenever ColorDelegator is called. ''' # Not automatic because ColorDelegator does not know 'text'. theme = idleConf.CurrentTheme() normal_colors = idleConf.GetHighlight(theme, 'normal') cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg') select_colors = idleConf.GetHighlight(theme, 'hilite') text.config( foreground=normal_colors['foreground'], background=normal_colors['background'], insertbackground=cursor_color, selectforeground=select_colors['foreground'], selectbackground=select_colors['background'], ) if TkVersion >= 8.5: text.config( inactiveselectbackground=select_colors['background'])
Example #2
Source File: test_images.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def colorlist(self, *args): if tkinter.TkVersion >= 8.6 and self.wantobjects: return args else: return tkinter._join(args)
Example #3
Source File: test_images.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def test_put(self): image = self.create() image.put('{red green} {blue yellow}', to=(4, 6)) self.assertEqual(image.get(4, 6), self.colorlist(255, 0, 0)) self.assertEqual(image.get(5, 6), self.colorlist(0, 128 if tkinter.TkVersion >= 8.6 else 255, 0)) self.assertEqual(image.get(4, 7), self.colorlist(0, 0, 255)) self.assertEqual(image.get(5, 7), self.colorlist(255, 255, 0)) image.put((('#f00', '#00ff00'), ('#000000fff', '#ffffffff0000'))) self.assertEqual(image.get(0, 0), self.colorlist(255, 0, 0)) self.assertEqual(image.get(1, 0), self.colorlist(0, 255, 0)) self.assertEqual(image.get(0, 1), self.colorlist(0, 0, 255)) self.assertEqual(image.get(1, 1), self.colorlist(255, 255, 0))
Example #4
Source File: configHandler.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def GetFont(self, root, configType, section): """Retrieve a font from configuration (font, font-size, font-bold) Intercept the special value 'TkFixedFont' and substitute the actual font, factoring in some tweaks if needed for appearance sakes. The 'root' parameter can normally be any valid Tkinter widget. Return a tuple (family, size, weight) suitable for passing to tkinter.Font """ family = self.GetOption(configType, section, 'font', default='courier') size = self.GetOption(configType, section, 'font-size', type='int', default='10') bold = self.GetOption(configType, section, 'font-bold', default=0, type='bool') if (family == 'TkFixedFont'): if TkVersion < 8.5: family = 'Courier' else: f = Font(name='TkFixedFont', exists=True, root=root) actualFont = Font.actual(f) family = actualFont['family'] size = actualFont['size'] if size < 0: size = 10 # if font in pixels, ignore actual size bold = actualFont['weight']=='bold' return (family, size, 'bold' if bold else 'normal')
Example #5
Source File: test_images.py From ironpython3 with Apache License 2.0 | 5 votes |
def colorlist(self, *args): if tkinter.TkVersion >= 8.6 and self.wantobjects: return args else: return tkinter._join(args)
Example #6
Source File: test_images.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_put(self): image = self.create() image.put('{red green} {blue yellow}', to=(4, 6)) self.assertEqual(image.get(4, 6), self.colorlist(255, 0, 0)) self.assertEqual(image.get(5, 6), self.colorlist(0, 128 if tkinter.TkVersion >= 8.6 else 255, 0)) self.assertEqual(image.get(4, 7), self.colorlist(0, 0, 255)) self.assertEqual(image.get(5, 7), self.colorlist(255, 255, 0)) image.put((('#f00', '#00ff00'), ('#000000fff', '#ffffffff0000'))) self.assertEqual(image.get(0, 0), self.colorlist(255, 0, 0)) self.assertEqual(image.get(1, 0), self.colorlist(0, 255, 0)) self.assertEqual(image.get(0, 1), self.colorlist(0, 0, 255)) self.assertEqual(image.get(1, 1), self.colorlist(255, 255, 0))
Example #7
Source File: configHandler.py From ironpython3 with Apache License 2.0 | 5 votes |
def GetFont(self, root, configType, section): """Retrieve a font from configuration (font, font-size, font-bold) Intercept the special value 'TkFixedFont' and substitute the actual font, factoring in some tweaks if needed for appearance sakes. The 'root' parameter can normally be any valid Tkinter widget. Return a tuple (family, size, weight) suitable for passing to tkinter.Font """ family = self.GetOption(configType, section, 'font', default='courier') size = self.GetOption(configType, section, 'font-size', type='int', default='10') bold = self.GetOption(configType, section, 'font-bold', default=0, type='bool') if (family == 'TkFixedFont'): if TkVersion < 8.5: family = 'Courier' else: f = Font(name='TkFixedFont', exists=True, root=root) actualFont = Font.actual(f) family = actualFont['family'] size = actualFont['size'] if size < 0: size = 10 # if font in pixels, ignore actual size bold = actualFont['weight']=='bold' return (family, size, 'bold' if bold else 'normal')
Example #8
Source File: test_images.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def colorlist(self, *args): if tkinter.TkVersion >= 8.6 and self.wantobjects: return args else: return tkinter._join(args)
Example #9
Source File: test_images.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_put(self): image = self.create() image.put('{red green} {blue yellow}', to=(4, 6)) self.assertEqual(image.get(4, 6), self.colorlist(255, 0, 0)) self.assertEqual(image.get(5, 6), self.colorlist(0, 128 if tkinter.TkVersion >= 8.6 else 255, 0)) self.assertEqual(image.get(4, 7), self.colorlist(0, 0, 255)) self.assertEqual(image.get(5, 7), self.colorlist(255, 255, 0)) image.put((('#f00', '#00ff00'), ('#000000fff', '#ffffffff0000'))) self.assertEqual(image.get(0, 0), self.colorlist(255, 0, 0)) self.assertEqual(image.get(1, 0), self.colorlist(0, 255, 0)) self.assertEqual(image.get(0, 1), self.colorlist(0, 0, 255)) self.assertEqual(image.get(1, 1), self.colorlist(255, 255, 0))
Example #10
Source File: configHandler.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def GetFont(self, root, configType, section): """Retrieve a font from configuration (font, font-size, font-bold) Intercept the special value 'TkFixedFont' and substitute the actual font, factoring in some tweaks if needed for appearance sakes. The 'root' parameter can normally be any valid Tkinter widget. Return a tuple (family, size, weight) suitable for passing to tkinter.Font """ family = self.GetOption(configType, section, 'font', default='courier') size = self.GetOption(configType, section, 'font-size', type='int', default='10') bold = self.GetOption(configType, section, 'font-bold', default=0, type='bool') if (family == 'TkFixedFont'): if TkVersion < 8.5: family = 'Courier' else: f = Font(name='TkFixedFont', exists=True, root=root) actualFont = Font.actual(f) family = actualFont['family'] size = actualFont['size'] if size <= 0: size = 10 # if font in pixels, ignore actual size bold = actualFont['weight']=='bold' return (family, size, 'bold' if bold else 'normal')