def pack(self, **kw): raise tk.TclError('Cannot use pack with the widget ' + self.__class__.__name__)
def pack(self, *a, **kw): raise tk.TclError("Cannot use pack with this widget.")
def place(self, *a, **kw): raise tk.TclError("Cannot use place with this widget.")
def _add_widget(self, widget, **kw): """Add the specified (existing) widget to the grid. This is an internal method to handle the behind-the-scenes aspects of styling, placement, and interaction with other widgets. Your application should use the public add_widget() method to create new widgets, which has a simpler interface and ensures they are created with the correct master. This method accepts keyword arguments for Tk's grid() method to configure the widget's placement in the grid. Returns the new widget. """ # Widgets spanning multiple rows are not currently supported. # Normally add_widget() will catch this before the widget is # created, but this is here as a failsafe in case some naughty # application is using our internal methods directly. if "rowspan" in kw: raise tk.TclError('the "rowspan" keyword ' 'is not currently supported') # Whether to colorize the widget if ("bg" in kw or "background" in kw or "fg" in kw or "foreground" in kw): # Don't colorize the widget if the user specified colors do_colorize = False else: # Assume we need to colorize the widget do_colorize = True # Separate keywords for grid() grid_kw = {} for key in self._GRID_KEYS: if key in kw: grid_kw[key] = kw[key] # Default to 1px horizontal padding if not "ipadx" in grid_kw: grid_kw["ipadx"] = 1 # Default to making all corners sticky if not "sticky" in grid_kw: grid_kw["sticky"] = "nsew" # Add the widget to the grid widget.grid(row=self._row, column=self._col, **grid_kw) # Store a reference to the widget self._cells[self._row].append(widget) # Pad self._cells if the widget spans multiple columns if "columnspan" in grid_kw: for _ in range(1, kw["columnspan"]): self._cells[self._row].append(None) # Bind the up and down arrow keys if self._enable_arrow_keys and self._row >= 1: try: # Identify the widget above this one upper = self._cells[self._row - 1][self._col] if upper: # Up arrow navigates from widget to upper widget.bind("<Up>", lambda event, upper=upper, lower=widget: self._navigate_up(upper, lower, event)) # Down arrow navigates from upper to widget upper.bind("<Down>", lambda event, upper=upper, lower=widget: self._navigate_down(upper, lower, event)) except (IndexError, tk.TclError): # Couldn't bind the arrow keys pass # Bind the left and right arrow keys if self._enable_arrow_keys and self._col >= 1: try: # Identify the widget left of this one left = self._cells[self._row][self._col - 1] if left: # Left arrow navigates from widget to left widget.bind("<Left>", lambda event, left=left, right=widget: self._navigate_left(left, right, event)) # Right arrow navigates from left to widget left.bind("<Right>", lambda event, left=left, right=widget: self._navigate_right(left, right, event)) except (IndexError, tk.TclError): # Couldn't bind the arrow keys pass # Increment the grid column if "columnspan" in grid_kw: self._col += grid_kw["columnspan"] else: self._col += 1 # Check if this is the longest row we've added, and if it is, # store its length for later reference if self._col > self._row_max: self._row_max = self._col # Set the default foreground/background colors if do_colorize: self._colorize(widget) # Return the new widget return widget
def grid(self, **kw): raise tk.TclError("cannot use grid with this widget")
def pack(**kw): """pack""" raise tk.TclError("cannot use pack with this widget")
def place(**kw): """place""" raise tk.TclError("cannot use place with this widget")
def pack(self, **kw): raise tkinter.TclError("cannot use pack with this widget")
def place(self, **kw): raise tkinter.TclError("cannot use place with this widget")
def place(self, **_kw): """ I don't know what this does. """ raise tk.TclError("cannot use place with this widget")
def get_image_tk(cls, image_file): if not(cls.is_image_file_valid(image_file)): raise tk.TclError("Error: Invalid image file") return ImageTk.PhotoImage(Image.open(image_file))
def place(self, **kwargs): raise tk.TclError("cannot use place with this widget")
def pack(self, **kwargs): raise tk.TclError("cannot use pack with this widget")
def place(self, **kw): raise tk.TclError("Cannot use place with the widget " + self.__class__.__name__)