Re: Python basic window control examples?
Re: Python basic window control examples? Mm, yes. It might be better to centralize those than repeat oneself. Do also check out amerikranian's guides as well, one [here] also covers windows, input, and TTS output. You can find a working copy of tolk [here], some tolk examples [here], some OpenAL examples [here], and a pygame example [here], post 3. URL: https://forum.audiogames.net/post/520364/#p520364 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Python basic window control examples?
Re: Python basic window control examples? Mm, yes. It might be better to centralize those than repeat oneself. Do also check out amerikranian's guides as well, one [here] also covers windows, input, and TTS output. You can find a working copy of tolk [here], some tolk examples [here], some OpenAL examples [here], and a pygame example:import pygame from pygame import mixer import sys def Example(): #initialize pygame pygame.init() #initialize sound mixer mixer.init() #create display window = pygame.display.set_mode([640,480]) #load sound sound = mixer.Sound('tone5.wav') #main update loop while True: for event in pygame.event.get(): if event.type == pygame.KEYDOWN: #if space is pressed, play sound if event.key == pygame.K_SPACE: sound.play() #if escape is pressed, quit if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit(0) #update window pygame.display.update() Example() URL: https://forum.audiogames.net/post/520364/#p520364 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Python basic window control examples?
Re: Python basic window control examples? Yes. This is a Magurp example of a simple window with a button. Note that you have to install wxpython: pip install wxpythonimport wxclass MyForm(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, title="Button Press Tutorial", size=(640,480)) #Add a panel so it looks correct on all platforms panel = wx.Panel(self, wx.ID_ANY) #create a visual button and label it ok self.btn = wx.Button(panel, label="OK",pos=(0,0)) #set buttons position to center of frame self.btn.SetPosition(((self.GetClientSize()[0]/2)-(self.btn.GetSize()[0]/2),(self.GetClientSize()[1]/2)-(self.btn.GetSize()[1]/2))) #bind the button press event to a function self.btn.Bind(wx.EVT_BUTTON, self.onBtnPress)#when button is pressed, this function is called def onBtnPress(self, event): #check the event ID to make sure it matches the button we want if event.GetId() == self.btn.GetId(): print("button pressed!")# Run the programif __name__ == "__main__": app = wx.App()#load the frame class frame = MyForm()#show it so its visible and active frame.Show() app.MainLoop() URL: https://forum.audiogames.net/post/520325/#p520325 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Python basic window control examples?
Re: Python basic window control examples? Not to be mean or anything, but if you look through his post history you’ll see plenty. They are not that hard to find URL: https://forum.audiogames.net/post/520316/#p520316 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Python basic window control examples?
Re: Python basic window control examples? Yeah, it would kind of be helpful if you could throw a few examples out there, of maybe pygame and WX.Thanks! URL: https://forum.audiogames.net/post/520295/#p520295 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: Python basic window control examples?
Re: Python basic window control examples? It depends. If you have a good grasp of the core basics IE: variables, if/else, loops, functions, and classes, then the next thing to look into is libraries and API's to expand the function set. For windows and graphics you'll want to look into libraries like Pyglet, Pygame, or wxPython, each has their own pro's and con's depending on what you want to do, but I can provide a brief comparison.Pyglet can handle 2D and 3D rendering and has support for 3D positional audio, though not extended features like HRTF or EFX. It can handling windowing, mouse, and keyboard support. The API itself has no native TTS support, so you'll need to use a library like Tolk, accessible_output2, or Pyttsx.Pygame is a fairly dependable library that's primarily been used for 2D, and supports basic audio functions. It can also handle mouse and keyboard input, and like Pyglet does not have native TTS support.wxPython is a widget based api, as such you can create windows and buttons, but is not terribly well suited for graphical rendering, which may be fine for your applications. It has some keyboard and mouse support, but doesn't have native audio support. Many of its widgets and functions do have native TTS support, but not all. If you like, I can provide examples or further descriptions for any or all of these libraries and how they can be used. URL: https://forum.audiogames.net/post/520188/#p520188 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector