Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Newbie Turtle if/then coordinates Problem
Post: RE: Newbie Turtle if/then coordinates Problem

The second if block will never be executed. If ball.xcor () returns anything greater that 390 then ball.setx () will reset it to 390. So, when you get to the second if then xcor will always be exactly...
BashBedlam Game Development 1 77 Jun-22-2021, 01:05 PM
    Thread: Plotting sum of data files using simple code
Post: RE: Plotting sum of data files using simple code

So... x is the sum of column one from all of the files and len (fnames) will be the number of files read. That makes x / len (fnames) the average that you're looking for... Right?
BashBedlam General Coding Help 3 311 Jun-16-2021, 02:06 PM
    Thread: [Solved] TypeError when calling function
Post: RE: TypeError when calling function

The gaussian () function requires five parameters. On line 26/27 you call it with only four.
BashBedlam General Coding Help 2 148 Jun-16-2021, 01:54 PM
    Thread: Plotting sum of data files using simple code
Post: RE: Plotting sum of data files using simple code

It's the comma in x = np.sum(data[:,0])/25 that's causing the error but there seems to be other things wrong with you code. I'm not sure so please let me know if this is what you were trying to accomp...
BashBedlam General Coding Help 3 311 Jun-10-2021, 05:58 PM
    Thread: AttributeError while switching between Sprite Animations
Post: RE: AttributeError while switching between Sprite ...

The problem is in the line ... self.image = pygame.image.load('player.png').convert_alphaIt's missing a set of parentheses in order to actually call the method. Try this: self.image = pygame.image.l...
BashBedlam Game Development 1 136 Jun-09-2021, 09:32 PM
    Thread: How Can I Draw Circle With Turtle İn Python ?
Post: RE: How Can I Draw Circle With Turtle İn Python ?

I assume that you have already learned turtle.penup () and turtle.pendown (). Have you been taught about turtle.circle () and that turtle.circle (radius, arc_angle) will draw an arc instead of a full ...
BashBedlam Homework 2 270 Jun-02-2021, 11:08 PM
    Thread: random in python
Post: RE: random in python

(Jun-02-2021, 12:35 AM)deanhystad Wrote: Choice is a function that returns an item randomly chosen from the list. So here's you you would use the returned value from the random.choice function: pri...
BashBedlam General Coding Help 3 370 Jun-02-2021, 01:14 AM
    Thread: compressing a file
Post: RE: compressing a file

It is difficult to determine exactly what you are asking but the following code will read any file as bytes. Is this what you are looking for? with open ('document.txt', 'rb') as input_file : the_fi...
BashBedlam General Coding Help 5 436 Jun-02-2021, 01:05 AM
    Thread: Spaceship
Post: RE: Spaceship

You have remove the section of code that calls all of the screen updating functions so I put them back. Also in draw_window () you update yellow_health using the variable red_health. import pygame im...
BashBedlam Game Development 8 650 Jun-01-2021, 02:24 PM
    Thread: UnboundLocalError
Post: RE: UnboundLocalError

For your knowledge, the variable passed was use before it was defined so I defined it on line 98. On line 146 of the new version, gamedisplay.update() was changed to game_display.update () The variabl...
BashBedlam Game Development 7 290 Jun-01-2021, 01:37 PM
    Thread: Function - Return multiple values
Post: RE: Function - Return multiple values

This might be another way to go about solving the problem: import os def subdirectory_iterator (root_directory) : for root, dirs, files in os.walk(root_directory, topdown=False): for name in dirs...
BashBedlam General Coding Help 10 593 Jun-01-2021, 12:50 AM
    Thread: FEN to 2dArray in Python
Post: RE: FEN to 2dArray in Python

This will convert what you have here but most likely will need significant modification to allow for all possible board configurations. At lest it's a start.. right? board_fen = ['bRbNbBbQbKbBbNbR/bp...
BashBedlam General Coding Help 1 197 May-31-2021, 03:43 PM
    Thread: Yielding ahead of time
Post: RE: Yielding ahead of time

See if this is what you wanted: def get_ep_info(iterator=False): ep_list_info = list() ep_nums = [1,2,3,4,5] for ep_num in ep_nums: ep_list_info.append (ep_num) if iterator is False: ...
BashBedlam General Coding Help 5 321 May-31-2021, 03:03 PM
    Thread: UnboundLocalError
Post: RE: UnboundLocalError

I have modified your code and it seems to be working as expected. On line 60, the game just quits if a crash occurs. I would recommend replacing that with some sort of options to replay from the start...
BashBedlam Game Development 7 290 May-31-2021, 01:05 PM
    Thread: Object Oriented programming (OOP) problem
Post: RE: Object Oriented programming (OOP) problem

Your function is not returning anything. Try it like this: #Create arbitrary class class Object(): def __init__(self,value1,value2,value3): self.v1=value1 self.v2=value2 self.v3=value3 #Creat...
BashBedlam General Coding Help 6 360 May-31-2021, 12:32 PM
    Thread: Why the save.txt part is not working
Post: RE: Why the save.txt part is not working

The last line should be indented like this: with open("save.txt", mode="w") as file: # See note 2. contents = file.write(f'{translated.text}')
BashBedlam General Coding Help 8 234 May-30-2021, 05:06 PM
    Thread: UnboundLocalError
Post: RE: UnboundLocalError

On line 130, you try to use passed in a call to score_system () before it is defined. On line 148, you try to call gamedisplays before it is defined. On line 35, obs_pic if referenced before it is ass...
BashBedlam Game Development 7 290 May-30-2021, 04:27 PM
    Thread: (solved) open multiple libre office files in libre office
Post: RE: absolute beginner - can I use python to do thi...

(May-29-2021, 02:17 PM)lucky67 Wrote: I have put the path in as './media/lw/'etc but the error message gives the path as /home/media/lw/etc Do you know how I can force it look outside the 'home' par...
BashBedlam General Coding Help 5 335 May-29-2021, 03:31 PM
    Thread: (solved) open multiple libre office files in libre office
Post: RE: absolute beginner - can I use python to do thi...

Yes, you can use python to do this. Here is the basic script for you to modify to fit your needs. If you would like for it to be called from a desktop icon, look into .desktop files. import subproces...
BashBedlam General Coding Help 5 335 May-29-2021, 01:08 PM
    Thread: Get anything before arguments
Post: RE: Get anything before arguments

Sorry **sad** On Linux Mint I get : Output:['python3', 'tester.py', 'arg1', 'arg2']
BashBedlam General Coding Help 3 318 May-19-2021, 01:16 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020