Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Error when using FIND
Post: RE: Error when using FIND
What is irec? Is it str or bytes? If it is bytes, your search pattern must also be bytes. Either way you should use a raw literal for the pattern to prevent "\x" being interpreted as an escape seq... |
|
deanhystad |
General Coding Help |
2 |
43 |
1 hour ago |
|
|
Thread: Manipulating panda dataframes more python-like
Post: RE: Manipulating panda dataframes more python-like
Looping in pandas is really slow. I would get the datetime values for two dataframes and process those to create a list of dataframe 2 rows that should be incorporated into dataframe 1. Something li... |
|
deanhystad |
Homework |
2 |
204 |
7 hours ago |
|
|
Thread: player just randomly teleporting to the edge of a platform in pygame
Post: RE: player just randomly teleporting to the edge o...
You should post your solution so others can benefit.
Pygame has lots of support for detecting collisions between things like players and platforms. In the code below I made the player and the platfo... |
|
deanhystad |
Game Development |
5 |
158 |
8 hours ago |
|
|
Thread: Virtual Environments - Organization (VS Code)
Post: RE: Virtual Environments - Organization (VS Code)
I have a venv for just messing around with Python. It is what I would use to test code I would write in response to a forum post. It slowly grows to have a lot of installed packages, but that is ok.... |
|
deanhystad |
General Coding Help |
11 |
259 |
9 hours ago |
|
|
Thread: Change a numpy array to a dataframe
Post: RE: Change a numpy array to a dataframe
Why are you using locals()? You should almost never use locals(). Is using locals() some weird conda notebook thing? If you can get locals()[ndarray_name], it means there is a local variable that r... |
|
deanhystad |
General Coding Help |
3 |
94 |
9 hours ago |
|
|
Thread: Change a numpy array to a dataframe
Post: RE: Change a numpy array to a dataframe
That was interesting. At first no attachment, then Pop! up it appears.
The screenshot is fairly worthless. Post the code that generates these results. The code provides context for what you are tr... |
|
deanhystad |
General Coding Help |
3 |
94 |
11 hours ago |
|
|
Thread: I'm trying to figure out if this is a bug from a simple quiz at Future Skill
Post: RE: I'm trying to figure out if this is a bug from...
My guess would be that there are 4 tests that you fail. Do you know all 6 tests? |
|
deanhystad |
Homework |
3 |
95 |
Jan-25-2023, 10:06 PM |
|
|
Thread: python print all files which contain specific word in it
Post: RE: python print all files which contain specific ...
You should really use pathlib. It is much better than manipulating paths using os.
I think you are using glob wrong. Instead of making a pattern that includes the path, I think you should specify t... |
|
deanhystad |
General Coding Help |
3 |
163 |
Jan-25-2023, 06:10 PM |
|
|
Thread: I'm trying to figure out if this is a bug from a simple quiz at Future Skill
Post: RE: I'm trying to figure out if this is a bug from...
You can use numbers like 1e-9 instead of using the pow() function.
def equal(a, b, zero=1e-9):
return abs(a-b) < zero
print(equal(1.1, 1.1))
print(equal(1.1, 1.1 + 1e-8))
print(equal(1.1, 1.1 ... |
|
deanhystad |
Homework |
3 |
95 |
Jan-25-2023, 03:21 PM |
|
|
Thread: Virtual Environments - Organization (VS Code)
Post: RE: Virtual Environments - Organization (VS Code)
How did you make your virtual environment? What is your OS? |
|
deanhystad |
General Coding Help |
11 |
259 |
Jan-25-2023, 03:08 PM |
|
|
Thread: Finding combinations of list of items (30 or so)
Post: RE: Finding combinations of list of items (30 or s...
All possible combinations of 30 items does take a while to compute. It is funny that you expect to print the output.
from itertools import combinations
items = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')[:4]... |
|
deanhystad |
General Coding Help |
1 |
126 |
Jan-25-2023, 02:57 PM |
|
|
Thread: Virtual Environments - Organization (VS Code)
Post: RE: Virtual Environments - Organization (VS Code)
What do you select? When selecting the python for a project I burrow down into the venv folder and select the python.exe.
Be aware that when vs code starts up, the first terminal does not run inside... |
|
deanhystad |
General Coding Help |
11 |
259 |
Jan-25-2023, 02:34 PM |
|
|
Thread: Virtual Environments - Organization (VS Code)
Post: RE: Virtual Environments - Organization (VS Code)
You can put the virtual environments anywhere. |
|
deanhystad |
General Coding Help |
11 |
259 |
Jan-25-2023, 01:56 PM |
|
|
Thread: player just randomly teleporting to the edge of a platform in pygame
Post: RE: player just randomly teleporting to the edge o...
You do the same thing if the condition is true or false, that is obviously wrong. |
|
deanhystad |
Game Development |
5 |
158 |
Jan-25-2023, 01:46 PM |
|
|
Thread: player just randomly teleporting to the edge of a platform in pygame
Post: RE: player just randomly teleporting to the edge o...
Once you land on the floor you start doing this:
def handle_collision(self, floor):
self.y = floor.y - self.height
self.y_velocity = 0
self.jumping = False
if (
... |
|
deanhystad |
Game Development |
5 |
158 |
Jan-24-2023, 09:59 PM |
|
|
Thread: QScrollArea does not work
Post: RE: QScrollArea does not work
You added a widget to the scroll widget window, but not in the correct way. Use scroll_area.setWidget(scrolled_widget).
You should also use layout managers instead of setGeometry. Run the attached ... |
|
deanhystad |
GUI |
3 |
118 |
Jan-24-2023, 07:38 PM |
|
|
Thread: sys.argv method
Post: RE: sys.argv method
I would provide a default filename. You can leave this in the code and it will not affect running from the command line.
inputFile=sys.argv[1] if len(sys.argv) > 1 else 'default_file' |
|
deanhystad |
General Coding Help |
3 |
211 |
Jan-23-2023, 10:41 PM |
|
|
Thread: Players not falling from the platform, and some other errors.
Post: RE: Players not falling from the platform, and som...
Jumping is fun because it involves physics.
The player is always being pulled downward by gravity. When your player jumps, you give the player an upward velocity. Gravity slows the upward velocity ... |
|
deanhystad |
Game Development |
1 |
86 |
Jan-23-2023, 10:28 PM |
|
|
Thread: [split] I want to add a code to the "Save" button to save the data entered
Post: RE: [split] Adding values with reduce() function f...
This does not do what you think it does:
Messageforyou = Label(top, text = "Park Wood School - Students Details")
.place(x = 100, y = 20)Label() returns a lablel widget. place() returns None. La... |
|
deanhystad |
GUI |
1 |
116 |
Jan-23-2023, 05:31 PM |
|
|
Thread: Adding values with reduce() function from the list of tuples
Post: RE: Adding values with reduce() function from the ...
Not great examples. I see why it was demoted from builtins and exiled to functools. |
|
deanhystad |
General Coding Help |
10 |
558 |
Jan-23-2023, 04:50 PM |