grid

Using grid() with TopLevel window not laying out widgets as expected

Using grid() with TopLevel window not laying out widgets as expected Question: I’m trying to use the grid() layout manager to apply to a Toplevel window that successfully opens, but I can only get pack() to work. It seems that using the grid(row=x, column=y) isn’t working – what am I missing please? I’m using the …

Total answers: 2

number of path grid problem Python, Memory Error and Recursion Error:

number of path grid problem Python, Memory Error and Recursion Error: Question: so i tried to solve a simple grid problem and i solve like this : def grid_count (n,m): if m == 1 and n == 1: return 1 if m == 0 or n == 0: return 0 return grid_count(m-1,n) + grid_count(m,n-1) and …

Total answers: 2

Is it possible to update a pygame drawing attribute when a event occurs?

Is it possible to update a pygame drawing attribute when clicking in a cell of a grid? Question: I’m approaching PyGame but I stepped on a problem: I am trying to draw a grid made out of single rectangle drawings, I want each one of those rectangle to fill or empty when the left mouse …

Total answers: 1

Gridspec subplots unexpected different size

Gridspec subplots unexpected different size Question: I am trying to create a grid of images using matplotlib. The first row and column define the input to a function and the rest of the grid is the output. Here’s someone else’s reference of how I would like it to look: reference. Especially note that lines seperating …

Total answers: 1

wxPython's wx.grid.Grid() won't come fully into view

wxPython's wx.grid.Grid() won't come fully into view Question: Issue: I’m experiencing an issue where a function that simply creates a Grid() works when called in one place, but not another place. When it is called from the “other,” non-working place, it does create a very small square in the corner of the window. At this …

Total answers: 1

Django display limited images in grid row

Django display limited images in grid row Question: As mentioned in the title. Is it possible to display a specific number of photos in a particular grid-container? For example, a maximum of 3 columns with a card in the row using a loop? I was able to achieve the effect of displaying all the photos …

Total answers: 2

Radius search in list of coordinates

Radius search in list of coordinates Question: I’m using python 2.7 and numpy (import numpy as np). I have a list of x-y coordinates in the following shape: coords = np.zeros((100, 2), dtype=np.int) I have a list of values corresponding to these coordinates: values = np.zeros(100, dtype=np.int) My program is populating these arrays. Now, for …

Total answers: 2

How do I change the color of a single rectangle in a grid?

How do I change the color of a single rectangle in a grid? Question: I’ve already programmed a grid, but now I want to change the color of a single rectangle in the grid. x = 5 y = 5 height = 30 width = 50 size = 20 color = (255,255,255) new_color = (255,255,0) …

Total answers: 1

Tkinter buttons bellow grid to close and save to file

Tkinter buttons bellow grid to close and save to file Question: I’m trying to create a grid of buttons that change colour with Tkinter. from tkinter import * class App(): def __init__(self, root): self.root = root buttonQ = Button(self.root, text = “Quit”, command = endProgam()) buttonS = Button(self.root, text = “Save”, command = saveToFile()) def …

Total answers: 1

Python – Plotting colored grid based on values

Python – Plotting colored grid based on values Question: I have been searching here and on the net. I found somehow close questions/answers to what I want, but still couldn’t reach to what I’m looking for. I have an array of for example, 100 values. The values are in the range from 0 to 100. …

Total answers: 3