Python guide part 3: menus, timers, and more

2019-09-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 3: menus, timers, and more

MenusA lot of questions evolve around the concept of menus. If you were used to BGT, you know that BGT has a module that is focused on menus and menus alone. When I started to learn Python, I kept looking for the non-existent module for creating menus. I couldn't find it. So, I had a great idea: Let's look at BGT's menu and converted the module to PythonWhat I didn't understand was that menus were glorified lists or arrays containing choices. Sure there are some variables that deal with music volume, holding down keys, and saving menu settings, but in a nutshell, a menu is a glorified list.The skeleton of a menuAll of the code samples dealing with keyboard input will be using pygameimport pygame, pygame.locals as pl
class menu:
 def __init(self):
  self.menu_choices = [] #Our menu options

 def add_item(self, item):
  self.menu_choices.append(item)

 def reset(self):
  self.menu_choices = []
  #Other reset settings go here

 def run(self):
  choice = 0
  while 1: #Continuously check for user input
   for event in pygame.event.get():
 if event.type == pygame.KEYDOWN:
  if event.key == pl.K_UP and choice > 0: #Prevent negative menu options
   choice -= 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_DOWN and choice < len(self.menu_choices)-1: #Prevent negative menu options
   choice += 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_RETURN: #User pressed enter
   return choice #We can see what the user chose

#Save this code in the file called menu.py
#Now, create another file and populate it with the following code:
import pygame, menu
pygame.init()
pygame.display.set_mode((600, 400))
pygame.display.set_caption("example menu")
m = menu.menu()

def main():
 m.reset() #Make sure nothing is left in our menu 
 m.add_item("start game")
 m.add_item("quit")
 choice = m.run()
 print(m.menu_choices[choice])

main()And there you go, a simple menu is created. Obviously you will want to expand the class at some point, but that should be enough to get you started.But wait...I have created a menu class that can support all of this and more. The only thing you'll have to do is add the sound and speaking logic to the class and you'll have a decent menu to work with. You can grab my version from hereNo examples will be provided as I think I have commented the code rather well.TimersIn a nutshell, a timer is a variable that gets updated with a new time every iteration of the loop that checks for time equality. Unfortunately, I was not smart enough to figure that out. Fortunately, I found someone that created a timer module and was kind enough to allow me to share it here. Stevo, or the Dwarfer, the dude who created Oh Shit, was kind enough to allow me to give out a public link to the timer script which I use in all of my projects. You can download the script here, and here is an example of the script being used.import timer

tmr = timer.timer()
def main():
 while 1:
  if tmr.elapsed >= 2000: #Two seconds
   break #Same as time.sleep(2)

main()As you can see, the timer module is a pretty simple one to use. I highly recommend you look through it despite me demonstrating a usage example, just because I didn't show you everything the module can do.SoundSound is probably the most difficult one to get right. There is sound_lib which is relatively simple to setup and use do to the Carter Temm's sound class which basically ports BGT sound methods to Python. To put it into perspective, here is how a script that plays a sound could look like when using Carter's module.Note: You must have the sound_lib folder and sound.py within the directory of your script.import sound
s = sound.sound()
s.load("gun.ogg") #This assumes that you also have a file called gun.ogg within the directory of your script
s.play()
while s.handle.is_playing: pass #Do nothingAs you can see, this is quick and easy to setup and use. Carter also wrote the sound positioning functions that keep their names from BGT but still work in Python. You can find them here. Sadly, there isn't a successful sound pool port for Python. I created one which sort of works, sort of. If you wish to try and salvage it, you can grab it here.However, the drawback with the sound_lib is that this option will not provide you with 3D sound support. I heard that the library can, in fact, do 3D positioning, but the effect is not that great.On another hand, a user by the name of Magurp244 has created some Open Al examples which you can find here. Open Al does have 3D support, echo, recording, and reverb functions, but the drawback to using this particular library is the soun

Python guide part 3: menus, timers, and more

2019-08-16 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 3: menus, timers, and more

MenusA lot of questions evolve around the concept of menus. If you were used to BGT, you know that BGT has a module that is focused on menus and menus alone. When I started to learn Python, I kept looking for the non-existent module for creating menus. I couldn't find it. So, I had a great idea: Let's look at BGT's menu and converted the module to PythonWhat I didn't understand was that menus were glorified lists or arrays containing choices. Sure there are some variables that deal with music volume, holding down keys, and saving menu settings, but in a nutshell, a menu is a glorified list.The skeleton of a menuAll of the code samples dealing with keyboard input will be using pygameimport pygame, pygame.locals as pl
class menu:
 def __init(self):
  self.menu_choices = [] #Our menu options

 def add_item(self, item):
  self.menu_choices.append(item)

 def reset(self):
  self.menu_choices = []
  #Other reset settings go here

 def run(self):
  choice = 0
  while 1: #Continuously check for user input
   for event in pygame.event.get():
 if event.type == pygame.KEYDOWN:
  if event.key == pl.K_UP and choice > 0: #Prevent negative menu options
   choice -= 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_DOWN and choice < len(self.menu_choices)-1: #Prevent negative menu options
   choice += 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_RETURN: #User pressed enter
   return choice #We can see what the user chose

#Save this code in the file called menu.py
#Now, create another file and populate it with the following code:
import pygame, menu
pygame.init()
pygame.display.set_mode((600, 400))
pygame.display.set_caption("example menu")
m = menu.menu()

def main():
 m.reset() #Make sure nothing is left in our menu 
 m.add_item("start game")
 m.add_item("quit")
 choice = m.run()
 print(m.menu_choices[choice])

main()And there you go, a simple menu is created. Obviously you will want to expand the class at some point, but that should be enough to get you started.But wait...I have created a menu class that can support all of this and more. The only thing you'll have to do is add the sound and speaking logic to the class and you'll have a decent menu to work with. You can grab my version from hereNo examples will be provided as I think I have commented the code rather well.TimersIn a nutshell, a timer is a variable that gets updated with a new time every iteration of the loop that checks for time equality. Unfortunately, I was not smart enough to figure that out. Fortunately, I found someone that created a timer module and was kind enough to allow me to share it here. Stevo, or the Dwarfer, the dude who created Oh Shit, was kind enough to allow me to give out a public link to the timer script which I use in all of my projects. You can download the script here, and here is an example of the script being used.import timer

tmr = timer.timer()
def main():
 while 1:
  if tmr.elapsed >= 2000: #Two seconds
   break #Same as time.sleep(2)

main()As you can see, the timer module is a pretty simple one to use. I highly recommend you look through it despite me demonstrating a usage example, just because I didn't show you everything the module can do.SoundSound is probably the most difficult one to get right. There is sound_lib which is relatively simple to setup and use do to the Carter Temm's sound class which basically ports BGT sound methods to Python. To put it into perspective, here is how a script that plays a sound could look like when using Carter's module.Note: You must have the sound_lib folder and sound.py within the directory of your script.import sound
s = sound.sound()
s.load("gun.ogg") #This assumes that you also have a file called gun.ogg within the directory of your script
s.play()
while s.handle.is_playing: pass #Do nothingAs you can see, this is quick and easy to setup and use. Carter also wrote the sound positioning functions that keep their names from BGT but still work in Python. You can find them here. Sadly, there isn't a successful sound pool port for Python. I created one which sort of works, sort of. If you wish to try and salvage it, you can grab it here.However, the drawback with the sound_lib is that this option will not provide you with 3D sound support. I heard that the library can, in fact, do 3D positioning, but the effect is not that great.On another hand, a user by the name of Magurp244 has created some Open Al examples which you can find here. Open Al does have 3D support, echo, recording, and reverb functions, but the drawback to using this particular library is the soun

Python guide part 3: menus, timers, and more

2019-08-14 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 3: menus, timers, and more

MenusA lot of questions evolve around the concept of menus. If you were used to BGT, you know that BGT has a module that is focused on menus and menus alone. When I started to learn Python, I kept looking for the non-existent module for creating menus. I couldn't find it. So, I had a great idea: Let's look at BGT's menu and converted the module to PythonWhat I didn't understand was that menus were glorified lists or arrays containing choices. Sure there are some variables that deal with music volume, holding down keys, and saving menu settings, but in a nutshell, a menu is a glorified list.The skeleton of a menuAll of the code samples dealing with keyboard input will be using pygameimport pygame, pygame.locals as pl
class menu:
 def __init(self):
  self.menu_choices = [] #Our menu options

 def add_item(self, item):
  self.menu_choices.append(item)

 def reset(self):
  self.menu_choices = []
  #Other reset settings go here

 def run(self):
  choice = 0
  while 1: #Continuously check for user input
   for event in pygame.event.get():
 if event.type == pygame.KEYDOWN:
  if event.key == pl.K_UP and choice > 0: #Prevent negative menu options
   choice -= 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_DOWN and choice < len(self.menu_choices)-1: #Prevent negative menu options
   choice += 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_RETURN: #User pressed enter
   return choice #We can see what the user chose

#Save this code in the file called menu.py
#Now, create another file and populate it with the following code:
import pygame, menu
pygame.init()
pygame.display.set_mode((600, 400))
pygame.display.set_caption("example menu")
m = menu.menu()

def main():
 m.reset() #Make sure nothing is left in our menu 
 m.add_item("start game")
 m.add_item("quit")
 choice = m.run()
 print(m.menu_choices[choice])

main()And there you go, a simple menu is created. Obviously you will want to expand the class at some point, but that should be enough to get you started.But wait...I have created a menu class that can support all of this and more. The only thing you'll have to do is add the sound and speaking logic to the class and you'll have a decent menu to work with. You can grab my version from hereNo examples will be provided as I think I have commented the code rather well.TimersIn a nutshell, a timer is a variable that gets updated with a new time every iteration of the loop that checks for time equality. Unfortunately, I was not smart enough to figure that out. Fortunately, I found someone that created a timer module and was kind enough to allow me to share it here. Stevo, or the Dwarfer, the dude who created Oh Shit, was kind enough to allow me to give out a public link to the timer script which I use in all of my projects. You can download the script here, and here is an example of the script being used.import timer

tmr = timer.timer()
def main():
 while 1:
  if tmr.elapsed >= 2000: #Two seconds
   break #Same as time.sleep(2)

main()As you can see, the timer module is a pretty simple one to use. I highly recommend you look through it despite me demonstrating a usage example, just because I didn't show you everything the module can do.SoundSound is probably the most difficult one to get right. There is Sound_lib, which is relatively simple to setup and use do to the Carter Temm's sound class which basically ports BGT sound methods to Python. To put it into perspective, here is how a script that plays a sound could look like when using Carter's module.Note: You must have the sound_lib folder and sound.py within the directory of your script.import sound
s = sound.sound()
s.load("gun.ogg") #This assumes that you also have a file called gun.ogg within the directory of your script
s.play()
while s.handle.is_playing: pass #Do nothingAs you can see, this is quick and easy to setup and use. Carter also wrote the sound positioning functions that keep their names from BGT but still work in Python. You can find them here. Sadly, there isn't a successful sound pool port for Python. I created one which sort of works, sort of. If you wish to try and salvage it, you can grab it here.However, the drawback with the sound_lib is that this option will not provide you with 3D sound support. I heard that the library can, in fact, do 3D positioning, but the effect is not that great.On another hand, a user by the name of Magurp244 has created some Open Al examples which you can find here. Open Al does have 3D support, echo, recording, and reverb functions, but the drawback to using this particular library is the sou

Python guide part 2: windows, keyboard input, and speech

2019-08-14 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows, keyboard input, and speech

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pyga

Python guide part 2: windows, keyboard input, and speech

2019-08-09 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows, keyboard input, and speech

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pyga

Python guide part 2: windows, keyboard input, and speech

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows, keyboard input, and speech

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pyga

Getting started guide to Python

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)A quick noteIf you have py launcher installed and are planning to run multiple Python versions, do not add python to environment variables. Py launcher provides a quick and a convenient way of launching python by typing py into your command line. Thanks to NicklasMCHD for this tip, I didn't know thatRunning scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no

Getting started guide to Python

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)A quick noteIf you have py launcher installed and are planning to run multiple Python versions, do not add python to environment variables. Py launcher provides a quick and a convenient way of launching python by typing py into your command line. Thanks to NicklasMCHD for this tip, I didn't know thatRunning scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no

Python guide part 2: windows, keyboard input, and speech

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows, keyboard input, and speech

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pyga

Python guide part 3: menus, timers, and more

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 3: menus, timers, and more

MenusA lot of questions evolve around the concept of menus. If you were used to BGT, you know that BGT has a module that is focused on menus and menus alone. When I started to learn Python, I kept looking for the non-existent module for creating menus. I couldn't find it. So, I had a great idea: Let's look at BGT's menu and converted the module to PythonWhat I didn't understand was that menus were glorified lists or arrays containing choices. Sure there are some variables that deal with music volume, holding down keys, and saving menu settings, but in a nutshell, a menu is a glorified list.The skeleton of a menuAll of the code samples dealing with keyboard input will be using pygameimport pygame, pygame.locals as pl
class menu:
 def __init(self):
  self.menu_choices = [] #Our menu options

 def add_item(self, item):
  self.menu_choices.append(item)

 def reset(self):
  self.menu_choices = []
  #Other reset settings go here

 def run(self):
  choice = 0
  while 1: #Continuously check for user input
   for event in pygame.event.get():
 if event.type == pygame.KEYDOWN:
  if event.key == pl.K_UP and choice > 0: #Prevent negative menu options
   choice -= 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_DOWN and choice < len(self.menu_choices)-1: #Prevent negative menu options
   choice += 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_RETURN: #User pressed enter
   return choice #We can see what the user chose

#Save this code in the file called menu.py
#Now, create another file and populate it with the following code:
import pygame, menu
pygame.init()
pygame.display.set_mode((600, 400))
pygame.display.set_caption("example menu")
m = menu.menu()

def main():
 m.reset() #Make sure nothing is left in our menu 
 m.add_item("start game")
 m.add_item("quit")
 choice = m.run()
 print(m.menu_choices[choice])

main()And there you go, a simple menu is created. Obviously you will want to expand the class at some point, but that should be enough to get you started.But wait...I have created a menu class that can support all of this and more. The only thing you'll have to do is add the sound and speaking logic to the class and you'll have a decent menu to work with. You can grab my version from hereNo examples will be provided as I think I have commented the code rather well.TimersIn a nutshell, a timer is a variable that gets updated with a new time every iteration of the loop that checks for time equality. Unfortunately, I was not smart enough to figure that out. Fortunately, I found someone that created a timer module and was kind enough to allow me to share it here. Stevo, or the Dwarfer, the dude who created Oh Shit, was kind enough to allow me to give out a public link to the timer script which I use in all of my projects. You can download the script here, and here is an example of the script being used.import timer

tmr = timer.timer()
def main():
 while 1:
  if tmr.elapsed >= 2000: #Two seconds
   break #Same as time.sleep(2)

main()As you can see, the timer module is a pretty simple one to use. I highly recommend you look through it despite me demonstrating a usage example, just because I didn't show you everything the module can do.SoundSound is probably the most difficult one to get right. There is Sound_lib, which is relatively simple to setup and use do to the Carter Temm's sound class which basically ports BGT sound methods to Python. To put it into perspective, here is how a script that plays a sound could look like when using Carter's module.Note: You must have the sound_lib folder and sound.py within the directory of your script.import sound
s = sound.sound()
s.load("gun.ogg") #This assumes that you also have a file called gun.ogg within the directory of your script
s.play()
while s.handle.is_playing: pass #Do nothingAs you can see, this is quick and easy to setup and use. Carter also wrote the sound positioning functions that keep their names from BGT but still work in Python. You can find them here. Sadly, there isn't a successful sound pool port for Python. I created one which sort of works, sort of. If you wish to try and salvage it, you can grab it here.However, the drawback with the sound_lib is that this option will not provide you with 3D sound support. I heard that the library can, in fact, do 3D positioning, but the effect is not that great.On another hand, a user by the name of Magurp244 has created some Open Al examples which you can find here. Open Al does have 3D support, echo, recording, and reverb functions, but the drawback to using this particular library is the sou

Python guide part 3: menus, timers, and more

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 3: menus, timers, and more

MenusA lot of questions evolve around the concept of menus. If you were used to BGT, you know that BGT has a module that is focused on menus and menus alone. When I started to learn Python, I kept looking for the non-existent module for creating menus. I couldn't find it. So, I had a great idea: Let's look at BGT's menu and converted the module to PythonWhat I didn't understand was that menus were glorified lists or arrays containing choices. Sure there are some variables that deal with music volume, holding down keys, and saving menu settings, but in a nutshell, a menu is a glorified list.The skeleton of a menuAll of the code samples dealing with keyboard input will be using pygameimport pygame, pygame.locals as pl
class menu:
 def __init(self):
  self.menu_choices = [] #Our menu options

 def add_item(self, item):
  self.menu_choices.append(item)

 def reset(self):
  self.menu_choices = []
  #Other reset settings go here

 def run(self):
  choice = 0
  while 1: #Continuously check for user input
   for event in pygame.event.get():
 if event.type == pygame.KEYDOWN:
  if event.key == pl.K_UP and choice > 0: #Prevent negative menu options
   choice -= 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_DOWN and choice < len(self.menu_choices)-1: #Prevent negative menu options
   choice += 1
   #To output an option, just do speak(self.menu_choices[choice])
   #No exact speech code is provided because I do not know what you will use for speech.
   #The same is true for sound
  if event.key == pl.K_RETURN: #User pressed enter
   return choice #We can see what the user chose

#Save this code in the file called menu.py
#Now, create another file and populate it with the following code:
import pygame, menu
pygame.init()
pygame.display.set_mode((600, 400))
pygame.display.set_caption("example menu")
m = menu.menu()

def main():
 m.reset() #Make sure nothing is left in our menu 
 m.add_item("start game")
 m.add_item("quit")
 choice = m.run()
 print(m.menu_choices[choice])

main()And there you go, a simple menu is created. Obviously you will want to expand the class at some point, but that should be enough to get you started.But wait...I have created a menu class that can support all of this and more. The only thing you'll have to do is add the sound and speaking logic to the class and you'll have a decent menu to work with. You can grab my version from hereNo examples will be provided as I think I have commented the code rather well.TimersIn a nutshell, a timer is a variable that gets updated with a new time every iteration of the loop that checks for time equality. Unfortunately, I was not smart enough to figure that out. Fortunately, I found someone that created a timer module and was kind enough to allow me to share it here. Stevo, or the Dwarfer, the dude who created Oh Shit, was kind enough to allow me to give out a public link to the timer script which I use in all of my projects. You can download the script here, and here is an example of the script being used.import timer

tmr = timer.timer()
def main():
 while 1:
  if tmr.elapsed >= 2000: #Two seconds
   break #Same as time.sleep(2)

main()As you can see, the timer module is a pretty simple one to use. I highly recommend you look through it despite me demonstrating a usage example, just because I didn't show you everything the module can do.SoundSound is probably the most difficult one to get right. There is Sound_lib, which is relatively simple to setup and use do to the Carter Temm's sound class which basically ports BGT sound methods to Python. To put it into perspective, here is how a script that plays a sound could look like when using Carter's module.Note: You must have the sound_lib folder and sound.py within the directory of your script.import sound
s = sound.sound()
s.load("gun.ogg") #This assumes that you also have a file called gun.ogg within the directory of your script
s.play()
while s.handle.is_playing: pass #Do nothingAs you can see, this is quick and easy to setup and use. Carter also wrote the sound positioning functions that keep their names from BGT but still work in Python. You can find them here. Sadly, there isn't a successful sound pool port for Python. I created one which sort of works, sort of. If you wish to try and salvage it, you can grab it here.However, the drawback with the sound_lib is that this option will not provide you with 3D sound support. I heard that the library can, in fact, do 3D positioning, but the effect is not that great.On another hand, a user by the name of Magurp244 has created some Open Al examples which you can find here. Open Al does have 3D support, echo, recording, and reverb functions, but the drawback to using this particular library is the sou

Python guide part 2: windows, keyboard input, and speech

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows, keyboard input, and speech

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pyga

Getting started guide to Python

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)A quick noteIf you have py launcher installed and are planning to run multiple Python versions, do not add python to environment variables. Py launcher provides a quick and a convenient way of launching python by typing py into your command line. Thanks to NicklasMCHD for this tip, I didn't know thatRunning scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pygame has be

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back![]As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already know[]VariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modules[]While it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal import[]What you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy []Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statement[]Python is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to games[]When it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing Pygame]Installing Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify tha

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back![]As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already know[]VariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modules[]While it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal import[]What you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy []Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statement[]Python is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to games[]When it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing Pygame]Installing Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify tha

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pygame has be

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pygame has be

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.Enough! Skip to gamesWhen it comes to making games, there are a few options available.PygamePygletPanda 3dThe ArcadeOther libraries that I probably left outThis guide will focus on Pygame, as it is what I use on the daily bases. If you like other examples to be included, PM me with the converted versions of the ones that will be shown here.Installing PygameInstalling Pygame is really simple. Assuming that you already have Python installed, opening up the command line and typingpip install pygameshould do the trick. To verify that Pygame has be

Python guide part 2: windows and keyboard input

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Python guide part 2: windows and keyboard input

Welcome Back!As promised,, here is the second part of this guide. This will attempt to demonstrate some more advanced concepts related to games. Beforehand though, let's make sure that we are on the same page.What you should already knowVariablesIf statementsLoops, both for and whileFunctionsCalling functionsPassing Parameters to FunctionsListsList and string SlicingDictionaries (Not critical but good to know)Classes (Possibly inheritance but not a big deal if you don't totally understand the concept, I used it once in a project)Class properties and how to access themImporting modules (I will mention this shortly)Importing modulesWhile it seems basic, I still would like to touch on the import statement, just to make sure that we are on the same page.The normal importWhat you may be familiar with is something like this:import math
print(math.pi)That is one way to link modules. However, to save you some typing, you can also do this:from math import *
print(pi)So what is the difference between the two?The box analogy Let's pretend that the Python console and the math module are boxes. The "import math" statement makes the two boxes sit next to each other. When you say something like "math.pi", you are basically opening the lid of a box labeled math, pull out the variable called pi, use it within your line of code, and put it back in the box shutting it as you do so. The advantage to this approach is that it keeps your global namespace nice and clean, unlike the second import method.The second import method is a little more crude. Instead of leaving the boxes next to each other, it takes the math box, opens it, dumps it's contents into the current namespace (The python console in my case) and then throws it away. This is why the earlier example with print(pi) works. We basically move whatever we specified in our import statement into the current namespace and throw everything else away.The drawbacks of the from statementPython is really nice. It allows us to change a string to an integer, or a boolean to a function. However, that can also become an issue if you love typing "from x import *". Because Python is so nice, it does not complain when you override a variable and change it's type. If your module has a function named "walk" that deals with moving objects around the grid and you type "from os import *", your walk function will be overwritten with the os's walk method which deals with looping through files and directories on your PC. The interpreter won't complain about the override until you try and use the walking function to move an object because as I said before, Python is nice.There is another spectrum to consider, however. Sometimes, you won't immediately notice that a function has been overwritten until you have moved farther along the development. A good example of this is the "open" function. It is available by default, dealing with opening files on your computer. If you also have a function named open in your module that accepts two strings as it's parameters, you would override the standard open method and will have a difficult time telling why something doesn't work as you expect it too.I have been saying functions, but they are not the only things that can be changed. Classes, lists, dictionaries... anything can change types in an instant when it comes to Python. Again, it's not bad, but it is something you should keep in mind. To that end, I use your standard "import x" and generally avoid "from x import y" in most cases. When I do use it, here is something that runs through my head before I include such statement.Am I using a star? Star tells Python to import everything from a module and thus is the most dangerous to use.Is it a standard or pip-installed library? If yes, then I avoid using a star all together and just import the entire module. (If you don't know what pip is, you will soon.) (If something is not in your project folder, math, for example, you know that it's either pip-installed or something that comes with the interpreter.)Can I reuse this later? This is important. If you import math in script1.py and you type from script1 import * in script2.py, you can use math in script2 without importing it again. If I can reuse the import in some way, it will have a greater chance of persuading me to type "from x import y"These questions help me decide if it's worth it to clutter my namespace.

URL: https://forum.audiogames.net/post/454136/#p454136




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Getting started guide to Python

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)A quick noteIf you have py launcher installed and are planning to run multiple Python versions, do not add python to environment variables. Py launcher provides a quick and a convenient way of launching python by typing py into your command line. Thanks to NicklasMCHD for this tip, I didn't know thatRunning scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no

Getting started guide to Python

2019-08-08 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.A quick noteIf you have py launcher installed and are planning to run multiple Python versions, do not add python to environment variables. Py launcher provides a quick and a convenient way of launching python by typing py into your command line. Thanks to NicklasMCHD for this tip, I didn't know that.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, n

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print("hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print("hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print(,hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print(,hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print(,hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Getting started guide to Python

2019-08-04 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Getting started guide to Python

Attention!Some of the commands mentioned here are NVDA-specific. If you would like other screen readers to be included, please send me the list of the navigation key commands and I will update the guide to include the informationIntroductionAs the community began shifting to Python, the same questions got introduced over and over again. How do I run scripts? How do I see errors? Where do I get Python? This guide will aim to introduce the basics of setting up Python and will hopefully go on to some more advanced concepts such as windows, sounds, and speech.Getting pythonPython can be downloaded by going to python.org and browsing to the "download" heading. Do to the constantly updating nature of the language, no link will be provided as it will probably change. The first link under the download heading should take you to the latest version page. From there it is as simple as choosing what platform you use and downloading the installer.InstallationNoteYou don't have to do everything I do, but some of these settings should save you some headache.A second noteIf I did not mention a setting in the installer, it remains at it's default valueActual installation instructionsFirst, do not click on "install now" option. Choose custom installation instead.I like to change my installation directory to something more obvious just in case I want to mess with the python folder, though it ultimately doesn't matter as long as it does not end up in program files on a 64-bit machine (I have been told and have experienced file writing errors because the app didn't have the permission to do so).Click next, and you should have some more options.I do not install the Idol, primarily because it appeared not to be accessible when I tried to use it. I do add python to my environment variables to save me some typing, and I do check the box for both associating .py with python and precompiling the standard library, though I am not too sure what the second one does. I have tried using python with and without debugging symbols and could not really tell the difference, so that box is left unchecked, at least on my machine.You should be good to install python now. After the installation completes, do not delete the installer. If by some chance you screw up your interpreter you can run it and click on the repair option (Saves you from reinstalling everything.)Running scriptsThere are two ways to run Python code. The most easiest way is to hit windows R to get into your run dialog and then type in python.NoteIf you are on windows 10 and typing python in the run dialog brings you to the Microsoft store, you must run the command from the command line. Read on how to do so.Opening Python via Command Line (CMD for short)To get into your command line, hit windows R and in the run dialog type cmd. This should bring you to the terminal where you can type in commands. Now type python.What you should see as the result of either stepIf everything worked correctly, a window should pop up with 3 greater than signs which signify that python is ready to receive input. Type this into your console:print(,hello World!")If you do not hear the message "hello world", make sure that your reporting of dynamic content changes are on by hitting NVDA+5 and run the command again.When you are ready to quit, typing exit() or quit() should close the console.Running scripts from filesThe console is great for quick and dirty tests, but what if you need to have multiple files in your project? This is a little trickier to do.Create a blank document.Type in print(,hello World!")Save your document as hello.pyOpen up your command lineGo into the directory where you have saved your file.If you do not know how to use CMD, cd directory_name takes you to that directory, such as cd desktop, and cd .. takes you back to the previous directory in relation to where you currently are.For example, the main python folder comes with a folder called lib inside it. If I was in the lib folder and I typed in cd .., I would now be back in the python directory.A quick tip: If you don't know how to spell something, hitting tab will move you through files and folders within your current directory. After that it is as simple as it is going to be to hit home and type in the desired command before the file name.Type in python hello.pyIf everything works as expected, great! You now are mostly ready to proceed with Python tutorials. If you do not get any output, make sure that reporting dynamic content changes option is  on by hitting NVDA+5 and repeat the command.Last note for file scriptsSometimes, your interpreter will just exit. No announcements of tracebacks, no weird output, no nothing. This is do to some error in your code that does not fall under the syntactical category. To this day, here are two solutions that I use on the regular basesEasy to learn, annoying to accessIf your program crashes, a good thing is to change your command frompython script.pyt

Tomb hunter review

2019-01-14 Thread AudioGames . net ForumArticles Room : amerikranian via Audiogames-reflector


  


Tomb hunter review

Tomb hunter review:All things start with something. In this case, I would like to start this with an apology for what you will read below. Let me assure you that I have nothing against the developers of the game. I have not interacted with them live, we have not had a conflict in the past, no. Below are my honest thoughts. I will encompass as much of the game as I can, but I'm a human and thus prone to make mistakes.My thoughts before the release:Let's get one thing out of the way. I really enjoyed the original MOTA. I've played every version of it, and enjoyed every single one of them. Naturally when I heard about Mason working on it, I got excited. Who wouldn't be?The first look:After trying the demo I must say, I was not thrilled with the gameplay. Everything starting from running jumps and ending with not being able to tell how far I'm moving, but I'll go into that in a bit. I've finished the demo, and then listened to Liam's stream. In fact, he in part inspired me to sit down and write this big old mess. I strongly agree with what he said, some of the game has large issues that testers should have caught. Strap yourself in, and remember, this is only an opinion of one man.Demo limitations:For anyone who hasn't played TH (Tomb hunter) demo, here are a couple of things you should know.1: It only has 7 levels.2: In the full version you will have access to the shop where you could exchange gold and gems for goodies. The demo, bless Mason's heart, disables it, making the game a bit harder to complete.3: No saving! The demo does not allow you to save your game, there by increasing overall difficulty of the game.Let's go over points 2 and 3 in a little more detail, shall we?The shop.In edition to exchanging gems for gold, you can spend that gold on certain goodies such as extra lives, potions, weapons, and level-specific items. The demo mode makes you unable to access the shop, making you more conservative with the way you use your items. On one hand it's good because it teaches you to save your items until you're in a pinch, but on the other hand, if I'm a new player, saving items is the least of my worries. If I have to worry how many swords I use and I don't know about the shop, I might not buy the game, fearing that it may be too difficult to complete. That, in my opinion is one of the bad choices in the designing the demo mode.Saving games.In the full version, whenever you win a level your game saves. As you might have guessed or known, it doesn't do that in the demo. I can't stress this enough! As a new player, I need that saving feature, especially because I'm learning new mechanics. It took me 3 tries to get to the end of the demo, 3. All because of some poor choice on the developers part. I'm learning something new, and the game gives me barely any room for errors. That's the worst thing you could do in the demo. The shop I might understand, but not being able to save? If I didn't know better, I'd say you're trying to drive the new players off the game instead of attracting them. Hell, if someone didn't buy the game for me, I wouldn't pay for it do to those two things combined.How can it be made better?Add the shop and saving into the demo. This will make the game more appealing to newer players, which could potentially bring in more cash.Right, I think I've covered the demo, let's move on to the actual game. First up, the story.My first question when I started a new game on the full version is why? Why didn't you allow the players to see the story in the demo? After all, it's not like they'd be getting a novel for free. They'd be getting 500 words at most. Besides, it would also explain why you're in the tomb, as right now the player is basically dropped off on level one without an explanation as to why or how they got into the tomb in the first place. The game also contains 0 of the storyline past that snippet. It's like the story was put on the backburner after you wrote those 500 words. The gate, for being a shitty game does have some story in hopes of interesting you, which is something TH despritly needs.The amazing registration system:Let's back up for a second. I just found out that Tomb Hunter needs to have a connection to the server for you to be able to play the full version. No! No no no no no! Mason, why! You have a history of taking your servers down, and when you do, folks are gonna raise hell on the forum. And let's face it. They will be within their right. Don't tell me that your server won't go down, a month or two ago someone had to upload the demo is a perfect example of unstable internet. I'm not saying it was your fault, but a lot of folks are going to be upset if your server goes down. I understand why you do it, but again, you don't have to be a monster in order to make your game secure. I like the system which tracks the number of pc's you register, for example, but making you unable to play Tomb Hunter without your server is just plain dumb.It all