• @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.

  • @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?


  • @mikael sincerely, I knew that. Why did I forget it? Is it not the proof that I have to stop to develop code?

  • @resserone13, for your app, this could work really well:


  • I put this code under touch_began() and its how I want. Every time the button is clicked the amount of taps is checked and if it meets the condition it adds 15 to the time.

    if self.tap_count % 20 == 0 and self.tap_count != 0: self.timer_value += 15
  • @mikael ok. That’s a good idea. I’ll add some.

  • @JonB thanks. I defined everything and added the music code and it’s stopping and starting on cue. Thank you for your help. I wasn’t sure how to use the stop resume and pause. I sometimes still have trouble figuring out little things.

  • I Still can’t get this scene to fade in? It fades out properly but will not faded in.

    class GameOver(Scene): def setup(self): self.game_over = SpriteNode( 'GameOver.PNG', position=(self.size.w/2, self.size.h/2), scale=1.10, parent=self) self.new_game = SpriteNode( 'StartNewGame.PNG', position=(self.size.w/2, self.size.h/2 * 0.33), scale=0.30, parent=self) self.game_over.alpha=0.5 self.new_game.alpha=0.5 self.game_over.run_action(A.fade_to(1, 2)) self.new_game.run_action(A.fade_to(1, 2)) def dismiss_scene(self): self.dismiss_modal_scene() def touch_began(self, touch): if touch.location in self.new_game.frame: self.main.bankroll_amount = 10_000 self.main.bankroll_amount_label.text = f'{self.main.currency_type}{self.main.bankroll_amount:,}' self.main.red_x.run_action(A.fade_to(0, 0.5)) self.main.main_node.run_action(A.fade_to(1, 1)) self.main.card_pos_1.run_action(A.fade_to(1, 1)) self.main.card_pos_2.run_action(A.fade_to(1, 1)) self.main.card_pos_3.run_action(A.fade_to(1, 1)) self.main.second_pos.run_action(A.fade_to(1, 1)) self.main.main_node.run_action(A.fade_to(1, 1.5)) self.game_over.run_action( A.sequence( A.fade_to(0, 2), A.wait(2), A.call(self.dismiss_scene))) self.new_game.run_action( A.sequence( A.fade_to(0, 2), A.wait(2), A.call(self.dismiss_scene
  • @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.

  • @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
  • @resserone13 This was helpful. Was having difficulty with creating delays and this cleared it up. Thanks for the pointer. Cheers.

  • @ccc would something like this be a good idea?

    position = (self.size.w/2, self.size.h * 1.60)

    If not would be so kind to so me the proper way.

  • @resserone13, it is a feature of scene that in the setup method we already know the size. Very convenient when compared to the ui module.

  • First of, you can move your *_patient_list into the Patient class to reduce global variables.

    class Patient(object): master_patient_list = [] # this should be shared among all Patients def __init__(self, ...): ... self.master_patient_class.append(self)

    Second, I think you want something like this for example:

    class Physician(Employee): illness2doctor = {} # shared dict mapping illness -> doctor for illness def __init__(self, name): # just as example self.name = name @classmethod def register_doctor(cls, doctor, illness): assert not illness in cls.illness2doctor # prevent overwrite cls.illness2doctor[illness] = doctor @classmethod def get_doctor_for(cls, patient): illness = patient.illness if illness not in cls.illness2doctor: raise KeyError("No doctor for illness") return cls.illness2doctor[illness] # --- usage --- # create a new physician alice = Physician(name="Alice") # alice can treat "Broken Leg" Physician.register_doctor(alice, "Broken Leg") # now we can get the doctor for patient1 print(Physician.get_doctor_for(patient1).name) # -> should print "Alice"
  • @ccc your right. When I made the body of the function I was imagining 3 dials with the numbers 0 through 9 and as they rotate when first dial hit 9 the next dial would click over to 1 and the first dial change to 0. Like an odometer. I figured it out but I see now all I need is <999 += 1.

    I was watching a video and thinking of what you recommended and came up with this

    def patient_id_gen(): ''' generates patient id one at a time as patient object is created ''' prefix = 'AD' for i in range(1000,9999): yield f"{prefix}{i}"
  • @mikael thanks for the feedback. I always appreciate it. I see now how checking the list the way I am isn’t going to work. The master list will have every patient who’s ever been at the hospital and the current list will only have current patients. That along with how I was storing them by name. With all this in mind I will try to figure something else out and let you know how it goes. Thanks

  • @mikael for the way I’m using them I would like there to be one list of patients. Not a list associated with each patient. I guess that means I should create the list outside of the class. Making them global. I will check back on the other thread with the cleaning log and see what I can figure out. Thank you for the information.

  • Why did you put end_time = end_time or datetime.now()

    It works together with having the end_time=None default in the method signature. If the method is not given an end_time, it is None, and then it gets the value of datetime.now().

    It is essentially a 1-line version of:

    if not end_time: end_time = datetime.now()

    You can also use and in a similar way, but with a different meaning. E.g.:

    some_value = obj and obj.attribute

    I.e., if obj is None, obj.attribute will not get called (which would raise an exception), and some_value gets assigned the None.

    This is again a more concise version of:

    some_value = obj if obj: some_value = obj.attribute

    ... or the much uglier (to me):

    some_value = obj.attribute if obj else obj

    And is this to check to se if the cleaning was started

    @property def started(self): return bool(self.start_time)

    Yes, but it is not really used in this code, and not very useful either, because the main way to get a cleaning object is with the start_cleaning method, so it is always at least started when you have it.

  • @ccc I was wondering why you recommend avoiding strftime()

Internal error.

Oops! Looks like something went wrong!