我正在学习pygame,并且一直关注this tutorial.
似乎有问题:
_display_surf = None
... self._display_surf.fill((0,0,0))
呈现黑色背景。尽管如此,我仍然收到此错误:
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "snake.py", line 86, in <module>
theApp.on_execute()
File "snake.py", line 79, in on_execute
self.on_render()
File "snake.py", line 49, in on_render
self._display_surf.fill((0,0,0))
AttributeError: 'NoneType' object has no attribute 'fill'
我的问题:我声明的变量应为哪种类型?
答案 0 :(得分:0)
# get all tracts in monmouth county
language_tract <- get_acs(geography = "tract",
variables = vars,
state = "NJ",
county = "Monmouth",
geometry = TRUE,
summary_var = "C16002_001",
output = "wide")
# get geometry of red bank borough
red_bank_place <- places("NJ", cb = TRUE, class = "sf") %>%
filter(NAME == "Red Bank")
# only tracts in red bank borough
red_bank_tracts <- language_tract %>%
filter(st_contains(red_bank_place, ., sparse = FALSE))
ggplot() +
geom_sf(data = red_bank_tracts, color = "blue", fill = NA) +
geom_sf(data = red_bank_place, color = "black", fill = NA)
完成了工作:变量变为pygame.Surface()