mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Fixed grid_columnconfigure() and grid_rowconfigure() methods of
Tkinter widgets to work in wantobjects=True mode.
This commit is contained in:
		
							parent
							
								
									d5c8ce7cc0
								
							
						
					
					
						commit
						e95977621d
					
				
					 2 changed files with 21 additions and 11 deletions
				
			
		| 
						 | 
					@ -1339,6 +1339,21 @@ class Misc:
 | 
				
			||||||
            args = args + (col2, row2)
 | 
					            args = args + (col2, row2)
 | 
				
			||||||
        return self._getints(self.tk.call(*args)) or None
 | 
					        return self._getints(self.tk.call(*args)) or None
 | 
				
			||||||
    bbox = grid_bbox
 | 
					    bbox = grid_bbox
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _gridconvvalue(self, value):
 | 
				
			||||||
 | 
					        if isinstance(value, (str, _tkinter.Tcl_Obj)):
 | 
				
			||||||
 | 
					            try:
 | 
				
			||||||
 | 
					                svalue = str(value)
 | 
				
			||||||
 | 
					                if not svalue:
 | 
				
			||||||
 | 
					                    return None
 | 
				
			||||||
 | 
					                elif '.' in svalue:
 | 
				
			||||||
 | 
					                    return getdouble(svalue)
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
 | 
					                    return getint(svalue)
 | 
				
			||||||
 | 
					            except ValueError:
 | 
				
			||||||
 | 
					                pass
 | 
				
			||||||
 | 
					        return value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _grid_configure(self, command, index, cnf, kw):
 | 
					    def _grid_configure(self, command, index, cnf, kw):
 | 
				
			||||||
        """Internal function."""
 | 
					        """Internal function."""
 | 
				
			||||||
        if isinstance(cnf, str) and not kw:
 | 
					        if isinstance(cnf, str) and not kw:
 | 
				
			||||||
| 
						 | 
					@ -1357,22 +1372,14 @@ class Misc:
 | 
				
			||||||
            for i in range(0, len(words), 2):
 | 
					            for i in range(0, len(words), 2):
 | 
				
			||||||
                key = words[i][1:]
 | 
					                key = words[i][1:]
 | 
				
			||||||
                value = words[i+1]
 | 
					                value = words[i+1]
 | 
				
			||||||
                if not value:
 | 
					                dict[key] = self._gridconvvalue(value)
 | 
				
			||||||
                    value = None
 | 
					 | 
				
			||||||
                elif '.' in str(value):
 | 
					 | 
				
			||||||
                    value = getdouble(value)
 | 
					 | 
				
			||||||
                else:
 | 
					 | 
				
			||||||
                    value = getint(value)
 | 
					 | 
				
			||||||
                dict[key] = value
 | 
					 | 
				
			||||||
            return dict
 | 
					            return dict
 | 
				
			||||||
        res = self.tk.call(
 | 
					        res = self.tk.call(
 | 
				
			||||||
                  ('grid', command, self._w, index)
 | 
					                  ('grid', command, self._w, index)
 | 
				
			||||||
                  + options)
 | 
					                  + options)
 | 
				
			||||||
        if len(options) == 1:
 | 
					        if len(options) == 1:
 | 
				
			||||||
            if not res: return None
 | 
					            return self._gridconvvalue(res)
 | 
				
			||||||
            # In Tk 7.5, -width can be a float
 | 
					
 | 
				
			||||||
            if '.' in res: return getdouble(res)
 | 
					 | 
				
			||||||
            return getint(res)
 | 
					 | 
				
			||||||
    def grid_columnconfigure(self, index, cnf={}, **kw):
 | 
					    def grid_columnconfigure(self, index, cnf={}, **kw):
 | 
				
			||||||
        """Configure column INDEX of a grid.
 | 
					        """Configure column INDEX of a grid.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,9 @@ Core and Builtins
 | 
				
			||||||
Library
 | 
					Library
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- Issue #20635: Fixed grid_columnconfigure() and grid_rowconfigure() methods of
 | 
				
			||||||
 | 
					  Tkinter widgets to work in wantobjects=True mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Issue #19612: On Windows, subprocess.Popen.communicate() now ignores
 | 
					- Issue #19612: On Windows, subprocess.Popen.communicate() now ignores
 | 
				
			||||||
  OSError(22, 'Invalid argument') when writing input data into stdin, whereas
 | 
					  OSError(22, 'Invalid argument') when writing input data into stdin, whereas
 | 
				
			||||||
  the process already exited.
 | 
					  the process already exited.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue