Day 18 – Turtle 与 GUI
绘制正方形 利用turtle进行正方形的绘制 # 导入模块 import turtle for i in range(4): turtle.forward(100) turtle.left(90) my_screen = turtle.Screen() # 点击屏幕推出GUI界面 my_screen.ex...
Day 19 – 实例、状态和高级函数
事件监听 turtle模块的事件监听,通过 screen 的 listen 方法实现。 from turtle import Turtle, Screen tim = Turtle() screen = Screen() def move_forward(): tim.forward(100) # 监听屏幕输...
Day 20 – 贪吃蛇(上)
设置游戏屏幕 from turtle import Screen screen = Screen() # 设置屏幕大小 screen.setup(width=600, height=600) # 设置背景颜色 screen.bgcolor('black') # 设置标题 screen.title('贪吃蛇')...
What calls the first async function? 什么调用第一个异步函数?
You can only call async functions from other async functions, because they might need to suspend themselves and everything that is waiting for them. This leads to a bit of a chicke...
How to make parts of an actor nonisolated 如何使 actor 的各个部分非隔离
All methods and mutable properties inside an actor are isolated to that actor by default, which means they cannot be accessed directly from code that’s external to the actor. Acce...
Windows 部署 Ollama
下载 Ollama在 https://ollama.com/download/ 页面下载,系统对应的 Ollama 程序。部署 Ollama安装 Ollama双击 Ollama 的程序,即可进行 Ollama 的安装。修改环境变量Ollama 的默认模型存储路径...
What is a synchronous function? 什么是同步函数?
By default, all Swift functions are synchronous, but what does that mean? A synchronous function is one that executes all its work in a simple, straight line on a single threa...
Day 4 – 随机化与列表
随机化 Python 提供random模块以实现随机化。详情可参考 https://docs.python.org/zh-cn/3.13/library/random.html # 导入 random 模块 import random # 1 到 10 的随机整数 rand_num = random....