我写了这个:
<!DOCTYPE html>
<html>
<head>
<title>Excavation / Site Visit Safety Checklist</title>
</head>
<body>
<h1>Excavation / Site Visit Safety Checklistor </h1>
<form id="general-info" action="form-to-email.php" method="post" enctype="text/plain">
<table>
<tr>
<td>Job Site Location: <input type="text" name="location"></td>
<td>Date: <input type="date" name="visit-date"></td>
<td>Time: <input type="time" name="visit-time"></td>
</tr>
<tr>
<td colspan="2">Dig Crew: <input type="text" name="dig-crew-name"></td>
</tr>
</table>
<div class="outside">
<table>
<tr>
<th>Outside Excavations</th>
<th>Yes</th>
<th>No</th>
<th>N/A</th>
</tr>
<tr>
<td>1. Have Services for Locates been called?</td>
<td><input type="radio" name="outside-question_one" value="yes"></td>
<td><input type="radio" name="outside-question_one" value="no"></td>
<td><input type="radio" name="outside-question_one" value="not_applicable"></td>
</tr>
<tr>
<td>2. Have Locates been completed?</td>
<td><input type="radio" name="outside-question_two" value="yes"></td>
<td><input type="radio" name="outside-question_two" value="no"></td>
<td><input type="radio" name="outside-question_two" value="not_applicable"></td>
</tr>
<tr>
<td>3. Are hazards clearly marked?</td>
<td><input type="radio" name="outside-question_three" value="yes"></td>
<td><input type="radio" name="outside-question_three" value="no"></td>
<td><input type="radio" name="outside-question_three" value="not_applicable"></td>
</tr>
<tr>
<td>4. Is personal protective equipment available?</td>
<td><input type="radio" name="outside-question_four" value="yes"></td>
<td><input type="radio" name="outside-question_four" value="no"></td>
<td><input type="radio" name="outside-question_four" value="not_applicable"></td>
</tr>
<tr>
<td>5. Are workers using protective equipment? (Hard hat, safety goggles, safety boots, safety harness)</td>
<td><input type="radio" name="outside-question_five" value="yes"></td>
<td><input type="radio" name="outside-question_five" value="no"></td>
<td><input type="radio" name="outside-question_five" value="not_applicable"></td>
</tr>
<tr>
<td>6. Are adequate shoring systems in place?</td>
<td><input type="radio" name="outside-question_six" value="yes"></td>
<td><input type="radio" name="outside-question_six" value="no"></td>
<td><input type="radio" name="outside-question_six" value="not_applicable"></td>
</tr>
<tr>
<td>7. Are ladders set properly?</td>
<td><input type="radio" name="outside-question_seven" value="yes"></td>
<td><input type="radio" name="outside-question_seven" value="no"></td>
<td><input type="radio" name="outside-question_seven" value="not_applicable"></td>
</tr>
<tr>
<td>8. Are dig crew members dressed appropriately? (i.e. shirts on, cleanliness)</td>
<td><input type="radio" name="outside-question_eight" value="yes"></td>
<td><input type="radio" name="outside-question_eight" value="no"></td>
<td><input type="radio" name="outside-question_eight" value="not_applicable"></td>
</tr>
<tr>
<td>9. Is housekeeping adequate?</td>
<td><input type="radio" name="outside-question_nine" value="yes"></td>
<td><input type="radio" name="outside-question_nine" value="no"></td>
<td><input type="radio" name="outside-question_nine" value="not_applicable"></td>
</tr>
<tr>
<td>10. Are First Aid kits available?</td>
<td><input type="radio" name="outside-question_ten" value="yes"></td>
<td><input type="radio" name="outside-question_ten" value="no"></td>
<td><input type="radio" name="outside-question_ten" value="not_applicable"></td>
</tr>
<tr>
<td>11. Has customer's site been adequately protected from damage and dirt?</td>
<td><input type="radio" name="outside-question_eleven" value="yes"></td>
<td><input type="radio" name="outside-question_eleven" value="no"></td>
<td><input type="radio" name="outside-question_eleven" value="not_applicable"></td>
</tr>
<tr>
<td>12. Lawn signs posted on site?</td>
<td><input type="radio" name="outside-question_twelve" value="yes"></td>
<td><input type="radio" name="outside-question_twelve" value="no"></td>
<td><input type="radio" name="outside-question_twelve" value="not_applicable"></td>
</tr>
</table>
</div>
<br />
<div class="inside">
<table>
<tr>
<th>Inside Excavations</th>
<th>Yes</th>
<th>No</th>
<th>N/A</th>
</tr>
<tr>
<td>1. Has customer's site been adequately protected from damage and dirt?</td>
<td><input type="radio" name="inside-question_one" value="yes"></td>
<td><input type="radio" name="inside-question_one" value="no"></td>
<td><input type="radio" name="inside-question_one" value="not_applicable"></td>
</tr>
<tr>
<td>2. Are hazards clearly marked?</td>
<td><input type="radio" name="inside-question_two" value="yes"></td>
<td><input type="radio" name="inside-question_two" value="no"></td>
<td><input type="radio" name="inside-question_two" value="not_applicable"></td>
</tr>
<tr>
<td>3. Is personal protective equipment available?</td>
<td><input type="radio" name="inside-question_three" value="yes"></td>
<td><input type="radio" name="inside-question_three" value="no"></td>
<td><input type="radio" name="inside-question_three" value="not_applicable"></td>
</tr>
<tr>
<td>4. Are workers using protective equipment? (Hard hat, safety goggles, safety boots, safety harness)</td>
<td><input type="radio" name="inside-question_four" value="yes"></td>
<td><input type="radio" name="inside-question_four" value="no"></td>
<td><input type="radio" name="inside-question_four" value="not_applicable"></td>
</tr>
<tr>
<td>5. Are crew members dressed appropriately (i.e. shirts on, cleanliness)</td>
<td><input type="radio" name="inside-question_five" value="yes"></td>
<td><input type="radio" name="inside-question_five" value="no"></td>
<td><input type="radio" name="inside-question_five" value="not_applicable"></td>
</tr>
<tr>
<td>6. Is housekeeping adequate?</td>
<td><input type="radio" name="inside-question_six" value="yes"></td>
<td><input type="radio" name="inside-question_six" value="no"></td>
<td><input type="radio" name="inside-question_six" value="not_applicable"></td>
</tr>
<tr>
<td>7. Are First Aid kits available?</td>
<td><input type="radio" name="inside-question_seven" value="yes"></td>
<td><input type="radio" name="inside-question_seven" value="no"></td>
<td><input type="radio" name="inside-question_seven" value="not_applicable"></td>
</tr>
<tr>
<td>8. Lawn signs posted on site?</td>
<td><input type="radio" name="inside-question_eight" value="yes"></td>
<td><input type="radio" name="inside-question_eight" value="no"></td>
<td><input type="radio" name="inside-question_eight" value="not_applicable"></td>
</tr>
<tr>
<td>9. Crew leader on site?</td>
<td><input type="radio" name="inside-question_nine" value="yes"></td>
<td><input type="radio" name="inside-question_nine" value="no"></td>
<td><input type="radio" name="inside-question_nine" value="not_applicable"></td>
</tr>
</table>
<br />
List any unique situations or problems that are not identified in this inspection report. These problems could be physical or they could involve a work practice or procedure. <br> <textarea name="comments" rows="10" cols="50"></textarea>
</div>
<button type="submit" value="Submit">Submit</button>
</form>
</body>
</html>
为什么不能同时按下两个按钮?
答案 0 :(得分:2)
尝试一下:
pygame.event.get()
在您的版本中,您正在pygame.key.get_pressed()
上进行迭代,并且您仅评估for循环中的最后一个事件(除quit逻辑以外),这意味着您仅评估最后一个按键。将代码移入循环,您可以评估所有事件。
如果要检测多个按键,请使用finish = False
while not finish:
for event in pygame.event.get():
if event.type == pygame.QUIT:
finish = True
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
print("C")
if keys[pygame.K_RIGHT]:
print("B")
if keys[pygame.K_UP]:
print("A")
Error: Request failed with status code 502
at createError (node_modules/axios/lib/core/createError.js:16:15)
at settle (node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (node_modules/axios/lib/adapters/http.js:237:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
答案 1 :(得分:2)
键盘事件(例如pygame.KEYDOWN
)仅在按下按钮时发生一次。
使用pygame.key.get_pressed()
连续评估按钮的状态。例如:
finish = False
while not finish:
for event in pygame.event.get():
if event.type == pygame.QUIT:
finish = True
keys = pygame.key.get_pressed()
if keys[pygame.K_UP]:
print "A"
if keys[pygame.K_RIGHT]:
print "B"
if keys[pygame.K_LEFT]:
print "C"
或者,如果您希望获得列表:
finish = False
while not finish:
for event in pygame.event.get():
if event.type == pygame.QUIT:
finish = True
keys = pygame.key.get_pressed()
if any(keys):
kmap = {pygame.K_UP : "A", pygame.K_RIGHT : "B", pygame.K_LEFT : "C"}
sl = [kmap[key] for key in kmap if keys[key]]
print sl