这两张表用这个 DELETE FROM slot_and_material_info sa JOIN render_project_info rp on rp.material_id = sa.material_id WHERE rp.id = 862006980171141120
时间: 2024-04-23 14:27:13 浏览: 13
这个SQL语句的作用是删除渲染项目队列表(render_project_info)和坑位和素材项目详情表(slot_and_material_info)中,素材项目表主键id(material_id)等于862006980171141120的记录。其中使用了JOIN操作,将两张表按照material_id进行连接。最后使用DELETE FROM语句删除符合条件的记录。
相关问题
为什么我的pyecharts点不亮set_radar这个方法
如果您在使用Pyecharts中的set_radar方法时无法点亮雷达图的点,可能是由于您没有将symbol参数设置为一个非空值导致的。请尝试将symbol参数设置为一个非空值,例如:
```python
from pyecharts import options as opts
from pyecharts.charts import Radar
data = [
[4300, 10000, 28000, 35000, 50000, 19000],
[5000, 14000, 28000, 31000, 42000, 21000],
]
radar = (
Radar()
.add_schema(
schema=[
opts.RadarIndicatorItem(name="销售", max_=6500),
opts.RadarIndicatorItem(name="管理", max_=16000),
opts.RadarIndicatorItem(name="信息技术", max_=30000),
opts.RadarIndicatorItem(name="客服", max_=38000),
opts.RadarIndicatorItem(name="研发", max_=52000),
opts.RadarIndicatorItem(name="市场", max_=25000),
]
)
.add("预算分配", data, symbol="circle", item_color="#ff0000")
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
.set_global_opts(title_opts=opts.TitleOpts(title="Radar-基本示例"))
)
radar.render("radar_base.html")
```
在上面的示例中,我们将symbol参数设置为"circle",这样就可以点亮雷达图的点了。
用python设计小游戏源代码_用Python设计一个经典小游戏
好的,我可以为你提供一个用 Python 设计的经典小游戏的源代码,比如俄罗斯方块。
```python
import pygame
import random
# 初始化pygame
pygame.init()
# 设置游戏窗口的大小
screen_width = 800
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('俄罗斯方块')
# 定义颜色
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
# 定义方块的大小
block_size = 20
# 定义游戏区域大小
play_width = 10 * block_size
play_height = 20 * block_size
# 定义游戏区域的位置
play_x = (screen_width - play_width) // 2
play_y = screen_height - play_height - 50
# 定义字体
font = pygame.font.SysFont(None, 30)
# 定义方块类
class Block:
def __init__(self, x, y, color):
self.x = x
self.y = y
self.color = color
# 定义方块形状
block_shapes = [
[[1, 1, 1],
[0, 1, 0]],
[[0, 2, 2],
[2, 2, 0]],
[[3, 3, 0],
[0, 3, 3]],
[[4, 0, 0],
[4, 4, 4]],
[[0, 0, 5],
[5, 5, 5]],
[[6, 6, 6, 6]],
[[7, 7],
[7, 7]]
]
# 随机生成方块
def new_block():
shape = random.choice(block_shapes)
block = []
for i in range(len(shape)):
row = []
for j in range(len(shape[i])):
if shape[i][j] != 0:
row.append(Block(j, i, shape[i][j]))
block.append(row)
return block
# 初始化游戏
def init_game():
global play_area, current_block, next_block, score
play_area = [[0] * 10 for _ in range(20)]
current_block = new_block()
next_block = new_block()
score = 0
# 绘制游戏区域
def draw_play_area():
for i in range(len(play_area)):
for j in range(len(play_area[i])):
if play_area[i][j] != 0:
pygame.draw.rect(screen, colors[play_area[i][j]], (play_x + j * block_size, play_y + i * block_size, block_size, block_size), 0)
# 绘制方块
def draw_block(block, x, y):
for i in range(len(block)):
for j in range(len(block[i])):
if block[i][j] != 0:
pygame.draw.rect(screen, colors[block[i][j]], (x + j * block_size, y + i * block_size, block_size, block_size), 0)
# 绘制下一个方块
def draw_next_block():
pygame.draw.rect(screen, WHITE, (play_x + play_width + 20, play_y, block_size * 4, block_size * 4), 0)
draw_block(next_block, play_x + play_width + 30, play_y + 10)
# 绘制得分
def draw_score():
score_text = font.render('Score: ' + str(score), True, WHITE)
screen.blit(score_text, (play_x + play_width + 20, play_y + 100))
# 判断方块是否可以移动
def can_move(block, x, y):
for i in range(len(block)):
for j in range(len(block[i])):
if block[i][j] != 0:
if x + j < 0 or x + j >= 10 or y + i >= 20 or play_area[y + i][x + j] != 0:
return False
return True
# 将方块加入游戏区域
def add_block_to_play_area(block, x, y):
for i in range(len(block)):
for j in range(len(block[i])):
if block[i][j] != 0:
play_area[y + i][x + j] = block[i][j]
# 判断是否有满行
def check_full_lines():
lines = []
for i in range(len(play_area)):
if 0 not in play_area[i]:
lines.append(i)
return lines
# 删除满行
def remove_full_lines(lines):
global score
for line in lines:
play_area.pop(line)
play_area.insert(0, [0] * 10)
score += 10 * len(lines)
# 主循环
def main_loop():
global current_block, next_block, score
clock = pygame.time.Clock()
fall_time = 0
fall_speed = 0.5
game_over = False
while not game_over:
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
if can_move(current_block, current_block_x - 1, current_block_y):
current_block_x -= 1
if event.key == pygame.K_RIGHT:
if can_move(current_block, current_block_x + 1, current_block_y):
current_block_x += 1
if event.key == pygame.K_UP:
rotated_block = list(zip(*current_block[::-1]))
if can_move(rotated_block, current_block_x, current_block_y):
current_block = rotated_block
if event.key == pygame.K_DOWN:
if can_move(current_block, current_block_x, current_block_y + 1):
current_block_y += 1
fall_time += clock.get_rawtime()
clock.tick()
if fall_time / 1000 >= fall_speed:
if can_move(current_block, current_block_x, current_block_y + 1):
current_block_y += 1
else:
add_block_to_play_area(current_block, current_block_x, current_block_y)
lines = check_full_lines()
if lines:
remove_full_lines(lines)
current_block = next_block
next_block = new_block()
current_block_x = 3
current_block_y = 0
if not can_move(current_block, current_block_x, current_block_y):
game_over = True
fall_time = 0
screen.fill(BLACK)
draw_play_area()
draw_block(current_block, play_x + current_block_x * block_size, play_y + current_block_y * block_size)
draw_next_block()
draw_score()
pygame.display.flip()
pygame.quit()
# 开始游戏
colors = [BLACK, RED, GREEN, BLUE, WHITE]
init_game()
current_block_x = 3
current_block_y = 0
main_loop()
```
这是一个简单的俄罗斯方块游戏,可以在 Pygame 中运行。