playing with python Arcade

I wanted to give python Arcade a test run.
link to website I used:
arcade.academy html
I like pygame, but it seems to be being not kept up, (I could just be looking in all the wrong places).
This seems really promising.
Here's some crazy errors I had ,  and in the code I'll comment how I got that.



I thought the virtual environment was the problem at first.
The documentation had a warning that Arcade doesn't do well in virtual environments.


But nope.  That wasn't it.
Maybe it contributed.












And success!  In virtual env, and without.









Anyways, back to yack shaving soon!

Here's some python Arcade code:




######### py_arcade.py #########
import arcade
# I still think putting what you are going to use as globals
# is safer if you put them in a class, and access them through there
# I'd be happy for someone to explain why not
class Config_urations(object):
  def __init__(self):
      self.WIDTH = 800
      self.HEIGHT = 600
      self.INTRO = 'HELLO ARCADE!'
      self.CENTER_X = self.WIDTH // 2
      self.CENTER_Y = self.HEIGHT // 2

def run_intro():
  configs = Config_urations()
  center_x = configs.CENTER_X - 180 #it must have a way to get the text width?
  center_y = configs.CENTER_Y
  arcade.open_window(configs.WIDTH, configs.HEIGHT, "Python arcade testing")
  arcade.set_background_color(arcade.color.WHITE)
  arcade.start_render()
  arcade.draw_text("Hello Arcade!", center_x, center_y,  arcade.color.BLACK, 18, width=300, align='center')
  arcade.finish_render()
  arcade.run()

###   Doing :  if __main__ == __name__ to run here, is what gave me all the ##crazy render errors
arcade.start_render()
run_intro()






Comments

Popular posts from this blog

Statistics, Python, Making a Stem Plot

Pandas Python and a little probability

JavaScript Ascii animation with while loops and console.log