Skip to content

Commit a39c3da

Browse files
authored
Example Fixes (#2625)
* Increase resolution to 720p * Remove excessive debug prints * Update animal facts api to v2 * Derp
1 parent ef757d1 commit a39c3da

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

arcade/examples/net_process_animal_facts.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"""
3131
import PIL.Image
3232
import random
33+
import traceback
3334
import time
3435
import json
3536
import urllib.request
@@ -206,8 +207,8 @@ def do_work(self, in_queue, out_queue):
206207
try:
207208
out_queue.put(selected_type.get_fact())
208209
out_queue.put(selected_type.get_image())
209-
except Exception as e:
210-
print("Error:", e)
210+
except Exception:
211+
traceback.print_exc()
211212

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

230231

231232
class CatFacts(Facts):
232-
"""Get random cat facts and iamges"""
233+
"""Get random cat facts and images"""
233234

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

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

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

261264
def get_image(self) -> arcade.Texture:
262265
"""Get a random dog image from https://random.dog"""

arcade/examples/perspective.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def on_update(self, delta_time: float):
123123
(1.0, 0.0, 0.0), (0, 0, 3), 180 * self.window.time
124124
)
125125
view_data.forward, view_data.up = arcade.camera.grips.look_at(view_data, (0.0, 0.0, 0.0))
126-
print(view_data)
126+
# print(view_data)
127127

128128

129129
def on_draw(self):

arcade/examples/procedural_caves_bsp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
VIEWPORT_MARGIN = 300
3838

3939
# How big the window is
40-
WINDOW_WIDTH = 800
41-
WINDOW_HEIGHT = 600
40+
WINDOW_WIDTH = 1280
41+
WINDOW_HEIGHT = 720
4242
WINDOW_TITLE = "Procedural Caves BSP Example"
4343

4444
MERGE_SPRITES = False

arcade/examples/procedural_caves_cellular.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
VIEWPORT_MARGIN = 300
3636

3737
# How big the window is
38-
WINDOW_WIDTH = 800
39-
WINDOW_HEIGHT = 600
38+
WINDOW_WIDTH = 1280
39+
WINDOW_HEIGHT = 720
4040
WINDOW_TITLE = "Procedural Caves Cellular Automata Example"
4141

4242
# How fast the camera pans to the player. 1.0 is instant.

0 commit comments

Comments
 (0)