Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions arcade/examples/net_process_animal_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"""
import PIL.Image
import random
import traceback
import time
import json
import urllib.request
Expand Down Expand Up @@ -206,8 +207,8 @@ def do_work(self, in_queue, out_queue):
try:
out_queue.put(selected_type.get_fact())
out_queue.put(selected_type.get_image())
except Exception as e:
print("Error:", e)
except Exception:
traceback.print_exc()

def start(self) -> int:
"""Start the process and wait for it to be ready"""
Expand All @@ -229,11 +230,12 @@ def get_image(self) -> arcade.Texture:


class CatFacts(Facts):
"""Get random cat facts and iamges"""
"""Get random cat facts and images"""

def get_fact(self) -> str:
with urllib.request.urlopen("https://meowfacts.herokuapp.com") as fd:
data = json.loads(fd.read().decode("utf-8"))
print(data)
return data["data"][0]

def get_image(self) -> arcade.Texture:
Expand All @@ -254,9 +256,10 @@ def __init__(self):
self.images = [i for i in self.images if not i.endswith(".mp4")]

def get_fact(self) -> str:
with urllib.request.urlopen("http://dog-api.kinduff.com/api/facts") as fd:
with urllib.request.urlopen("https://dogapi.dog/api/v2/facts") as fd:
data = json.loads(fd.read().decode("utf-8"))
return data["facts"][0]
print(data)
return data["data"][0]["attributes"]["body"]

def get_image(self) -> arcade.Texture:
"""Get a random dog image from https://random.dog"""
Expand Down
2 changes: 1 addition & 1 deletion arcade/examples/perspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def on_update(self, delta_time: float):
(1.0, 0.0, 0.0), (0, 0, 3), 180 * self.window.time
)
view_data.forward, view_data.up = arcade.camera.grips.look_at(view_data, (0.0, 0.0, 0.0))
print(view_data)
# print(view_data)


def on_draw(self):
Expand Down
4 changes: 2 additions & 2 deletions arcade/examples/procedural_caves_bsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
VIEWPORT_MARGIN = 300

# How big the window is
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
WINDOW_TITLE = "Procedural Caves BSP Example"

MERGE_SPRITES = False
Expand Down
4 changes: 2 additions & 2 deletions arcade/examples/procedural_caves_cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
VIEWPORT_MARGIN = 300

# How big the window is
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
WINDOW_TITLE = "Procedural Caves Cellular Automata Example"

# How fast the camera pans to the player. 1.0 is instant.
Expand Down
Loading