Skip to content

Tag: python-3.x

Why is the class attribute changing only once?

Battlefield.field is dictionary with keys: I know that this is far from the best solution, but to work with this, I decided to write a cursor class: My problem: When I try to move a cursor multiple times by using the “up” function and others, the self.point value changes only once. The last use a …

Python pass array into function and use it in json return

I have the following python code: I wanted to put a try/except on the requestAPI function so it does’nt break the code. I thought about this: I could do something like: But i think there’s a better way of doing this. Answer You can achieve it without a try-except via dict.get(): This will return t…

Scrollable frame class in tkinter

I have implemented my own scrollable frame class in tkinter: This works fine, but the problem is to add widgets to the scrolled frame, the parent has to be exampleFrame.content. I have looked at several other examples which all have the same limitation. Is it possible to configure the class so exampleFrame ca…

X-axis out of order seaborn histplot

I am trying to create a seaborn histplot and am almost done, however, I noticed that my x-axis is out of order. Displays: Adding order argument as shown here creates the following error(s): How can I force that order on my x-axis? Answer You could create a bar plot, using np.histogram to count how many values…

How to find how many words are in a file [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I&#82…