title: Setting resolution for a window using Pyglet and moving
body: <p>I'm new to using Pyglet in python and have some problems with my code. First of all, I don't know why setting the resolution doesn't work. Second of all, when I try to move the "snake" it doesn't do anything. Any help is appreciated.</p>
  
  <pre><code>import pyglet
  import random
  
  pyglet.resource.path = ["resources"]
  pyglet.resource.reindex()
  
  
  class Snake_Window(pyglet.window.Window):
  
      def __init__(self):
          super(Snake_Window, self).__init__()
  
          self.width = 1280
          self.height = 720
          # sets the resolution of window
  
          self.key_handler = pyglet.window.key.KeyStateHandler()
          self.push_handlers(self.key_handler)
          # sets keys
  
          self.set_caption("Wild Snake")
          # gives it a name
  
          self.background_image = pyglet.resource.image("background.png")
          self.food_image = pyglet.resource.image("food.png")
          self.snake_head_image = pyglet.resource.image("snake_head.png")
          self.snake_body_image = pyglet.resource.image("snake_body.png")
          # makes images usable
  
          self.center_image(self.food_image)
          self.center_image(self.snake_head_image)
          self.center_image(self.snake_body_image)
          # centers the images using center_image
  
          self.snake_head = pyglet.sprite.Sprite(img=self.snake_head_image, x=200, y=200)
          self.snake_head.scale = 0.5
          self.snake_head.rotation = 180
  
          self.snake_body = pyglet.sprite.Sprite(img=self.snake_body_image, x=400, y=200)
          self.snake_body.scale = 0.5
          self.snake_body.rotation = 180
  
          self.snake_head.draw()
          self.snake_body.draw()
  
          self.food = []
  
          self.c = self.snake_head.x
          self.a = self.snake_head.x
          self.b = self.snake_head.y
  
          pyglet.clock.schedule_interval(self.game_tick, 1)
  
      def center_image(self, image):
          # sets the center of the image to the actual center
          image.anchor_x = image.width / 2
          image.anchor_y = image.height / 2
  
      def update_snake_head(self):
          if self.key_handler[pyglet.window.key.RIGHT]:
              self.c = self.a
              self.c += 200
          elif self.key_handler[pyglet.window.key.LEFT]:
              self.c = self.a
              self.c -= 200
          elif self.key_handler[pyglet.window.key.UP]:
              self.c = self.b
              self.c += 200
          elif self.key_handler[pyglet.window.key.DOWN]:
              self.c = self.b
              self.c -= 200
          else:
              print("čau")
  
      def update_snake_body(self):
          if self.key_handler[pyglet.window.key.RIGHT]:
              self.c = self.a
              self.c += 200
          elif self.key_handler[pyglet.window.key.LEFT]:
              self.c = self.a
              self.c -= 200
          elif self.key_handler[pyglet.window.key.UP]:
              self.c = self.b
              self.c += 200
          elif self.key_handler[pyglet.window.key.DOWN]:
              self.c = self.b
              self.c -= 200
          else:
              print("čau")
  
      def game_tick(self, dt):
          self.update_snake_head()
          self.update_snake_body()
          self.draw_elements()
  
      def draw_elements(self):
          self.clear()
          self.snake_head.draw()
          self.snake_body.draw()
  
  game_window = Snake_Window()
  
  pyglet.app.run()
  </code></pre>