Found a vid on YouTube that helped me out. I had self in the wrong place and was using the brackets inside of action.call()
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Best posts made by resserone13
-
RE: Creating functions that work with my scene class
-
RE: file not found error
@ccc i depends on how you wanted to go about it. the teacher mention that some students used csv module. its a really basic class. i used what was explained in class.
-
RE: scenes updating each other’s variables
@JonB Thank you for the advice. I’m going to try to work this in. I am also going to review all of my post to make sure I haven’t missed any advice. I really appreciate you guys helping me. I’ve seen some things you guys have worked on on github and it is much above my level. I appreciate you guys taking the time to help me. I feel it’s a privilege to be helped by people who know so much. Thank you very much @mikael @ccc @cvp.
-
RE: What this error
@cvp that sounds good. Once I get I done which should be in the next day or 2 I’ll post it on GitHub or the forum and let you know. It should be pretty simple. Each scene will have a title, a picture of the mask, and a description of when it should be used. I’ll let you know.
-
New game made with scene
So I have finished my game using the scene module. I have posted it on GitHub. I would like to thank everyone who helped and answered my questions. Being completely new to program and I couldn’t have run it without the help of you guys. Thank you @mikael , @cvp, @ccc and @JonB. Also thank you to @omz for making Pythonista. I have really enjoyed learning Python while using Pythonista. I would like to keep updating this game to learn how to code better. I would like to convert this So that it’s using more classes and functions. I wrote this the only way I knew How. I do not think it is the best way. I would like to learn how to do it the best way though. Please let me know if there’s anything I’m missing on the GitHub or if there’s any issues. It is my first time using GitHub. I welcome all feedback. Thanks.
-
RE: Playing sound
@cvp I’ve got it to work with all the other sound effects by using the sound.playeffect(). I think there might be a problem when you use sound.player() with sound.playeffect(). This is what I’m using.
class MainScene (Scene): def setup(self): bg_music = sound.play_effect('3 card monte beat (90.00 BPM) - MAIN OUT.wav', volume=.25) bg_music.looping = True
-
RE: Playing sound
@cvp I was able to fix the background music from stopping and being interrupted. I had to remove the volume in pitch settings I had on the two sound effects that were causing the trouble. I’m guessing the sound effects were interrupting the volume in pitch and canceling out the background music.
Latest posts made by resserone13
-
RE: file not found error
@ccc i depends on how you wanted to go about it. the teacher mention that some students used csv module. its a really basic class. i used what was explained in class.
-
RE: file not found error
@JonB your right. i submitted the wrong file types and the files were named incorrectly. ill have to pay more attention to things like that.. the were now working on a dice rolling exerecise and a mystery door game show ... ill make sure to submit the proper file types..
-
RE: file not found error
this was what i turned in for my homework. my teach said there was some name errors and that the file didnt run completely. maybe he was talking about the type of file i uploaded. it worked fine in my comp. i was using spyder only cus im on my comp. here was the homework and my code
Create a single Python script (.py) that completes the following steps:
Read the "US_state_populations.csv" file into Python using any method you like.
Create a new file called "alphabetic.csv". This file should contain the same 3 columns (state names, 2019 populations, and 2010 populations) separated by commas, but they should sorted alphabetically by the state name. You may write to this file using any method you like. Hint: When you sort the state names, make sure the 2010 and 2019 populations are sorted with their respective states.
Calculate the change in population between 2010 and 2019 (change = pop2019 - pop2010). Create a new file called "popchange.txt". This file should contain 2 columns: state names and population change, separated by a blank space. The file should contain a header line. You should write to this file manually using a for loop (not numpy, pandas, or any other library).
Upload your Python script, "alphabetic.csv" and "popchange.txt" to this Canvas assignment.list_of_list = [] #variable with file name. file_name = 'C:/Users/resse/Desktop/projects/poptest/US_state_populations2.csv' new_file = 'C:/Users/resse/Desktop/projects/poptest/abc2.csv' pop_diff = 'C:/Users/resse/Desktop/projects/poptest/pdiff.csv' #opens and closes file. with open(file_name, 'r') as f: #loops over file line by line. f.seek(23) for line in f: #saves each line as a list items = line.strip().split(',') #adds each list to a list list_of_list.append(items) #sorts the list s = sorted(list_of_list) #prints the sorted list print(s) #opens the new file and adds a sorted list to it. with open(new_file, 'w') as n_f: for i in s: n_f.write(f'\n {i[0]}, {i[1]}, {i[2]}') with open(pop_diff, 'w') as d_f: #writess the colum headers d_f.write(f'p19, p10, pdiff') #loops through a sorted list of states and population numbers for i in s: #calculates the population difference diff = int(i[1]) - int(i[2]) #writes each years population to a colum and #writes the population difference d_f.write(f'\n{i[1]}, {i[2]}, {diff}')
-
RE: file not found error
@JonB thanks for the heads up on the backslashes. i havent worked with file that much and i never noticed.. thanks the isssue was a typo new it too but i had copied and pasted then i typed it. that along with the backslash error it was all mixed up... thanks for all you advice as always.
-
RE: file not found error
@JonB i got it to find the file with the full path and now in using just the file name... i think i was missing a '' at the beginning of the file name now im getting
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \UXXXXXXXX escape
with this code
with open('\US_state_populations2.csv', 'r') as f: pass
-
RE: file not found error
@cvp im laughing so hard right now. if i turned your code in the teach would be wanting to learn from me(technically you) hahahahah to funny. once i figure out the file not found im going to tryout your code gonna finish mine too. i was gonna get each line and seprate the different parts into a list and pick the items from the list.
-
RE: file not found error
@cvp im using a windows laptop. here is the code. i need to sort the states and save a new file with the sorted states and populations in colums. it should be easy ive been figuring out most of it and i have the class video as a guide. im trying not to copy the class video. i had it woring but now it stopped.
#List cities = [] pop_2019 = [] pop_2010 = [] #opens and closes file with open('US_state_populations.csv', 'r'): #iterates over the file. for Line in f: #c = f.readline().strip().split(',') city = c[0] p_2019 = c[1] p_2010 = c[2] print(str(city)) print(p_2019) print(p_2010) #abc_file = open('alphabetic.csv', 'w',)```
-
file not found error
long time no see. im trying to do some homework for a cis class im taking at my community college. i need to open a file and its saying file not found. another bull fn ish error that i cant figure out. keeps saying file not found.. i have the .py file in the same folder as the .csv and i have copied and pasted the file name to avoid any misspellings. any suggestions on what else can be the issue..
-
RE: Ui button action parameters
@cvp @ccc @mikael Here is the UI version of the personal protective equipment app. It looks kind of plain. Any suggestions to spruce up how it looks?
-
RE: Ui button action parameters
Thanks @cvp @ccc and @mikael for the help. I was able to get past the hang up and move forward on the app development. I ended up using @ccc suggestion because i was using code very similar to what I already had. I’m finishing up a few more things then I will post on GitHub.
def add_btn(self, btn_names, actions_list): for i, (n, a) in enumerate(zip(btn_names, actions_list)): btn= ui.Button() btn.background_color=btn_clr btn.title=n btn.font=(btn_fnt, btn_txt_sz) btn.tint_color=txt_clr btn.border_width=2 btn.border_color=txt_clr btn.frame=(width * 0.15, height * (0.12 + i * 0.1), width * 0.7, height * 0.05) btn.corner_radius= btn_corner_radius btn.action=a self.add_subview(btn)