Re: How to create pygame menus

All right, sorry, a couple things. First I did realize that my indentations were off, I was consistent so my program ran fine and I wasn't paying close attention. Second thanks for the tip for the functions I didn't know that. I Changed that in my list and I am still getting weird output. It is different though. Also, I did not right a condition for the case of the item number being larger or smaller yet. I did know that it was an issue, sorry for not making that clear in the previous post, I just wanted to get this working first.
Can you explain more about why i should use tuples?
Also, I actually try and follow Pep8 when I am righting nontesting python, but here I am just trying to get this working for my own knowledge base. What standards am I not following other than doc strings and comments? I have not read the standards for classes yet sinse I just learned them recently. I am probably going to do that right now.

I was able to use a find and replace on my tabs to convert them to spaces to make it more readable to NVDA and Jaws. I forget that when pasting code into forms you have to account for tabs converting.

class Menu():
    def run(self, items, title):
        itemNumber = 0
        itemsLength = len(items)
        currentItem = items[itemNumber]
        closeMenu = False
        spk(title)
        spk(currentItem)
        while closeMenu == False:
            for event in pygame.event.get():
                key = pygame.key.get_pressed()
                if key[pygame.K_t]:
                    spk(title)
            &nbs p;   if key[pygame.K_RETURN] or key[pygame.K_ENTER]:
                    return currentItem[1]
                if key[pygame.K_DOWN]:
                    itemNumber += 1   
                    spk(currentItem)
                if key[pygame.K_UP]:
                    itemNumber -= 1
                    spk(currentItem)
                if key[pygame.K_x]:
                    spk("closing menu")
                    closeMenu = True

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector

Reply via email to