Article 5SXN3 [Python] restart once screenlock has been unlocked

[Python] restart once screenlock has been unlocked

by
Arch4GoodieLike
from LinuxQuestions.org on (#5SXN3)
I want to add the ability once the screenlock has been unlocked, it will spawn me back into lockscreen so I can guess the combination again ( the list of possible combinations is already there but not visible in the code snippet)
It's line 25 and onwards
Code:def draw(self):

if not self.unlocked:

screen.blit(self.points_surf, (DRAW_OFFSET[0]-POINT_RADIUS, DRAW_OFFSET[1]-POINT_RADIUS))
combo = self.wrong_pattern if self.wrong_pattern else self.current_combination
combo = [self.get_pos(p) for p in combo]

for p in combo:
screen.blit(self.selected_point_surf, (p[0]-SELECTION_RADIUS, p[1]-SELECTION_RADIUS))

if self.wrong_pattern:
try:
pygame.draw.lines(screen, (200, 80, 20), False, combo, POINT_RADIUS)
except ValueError: pass
else:
combo.append((pygame.mouse.get_pos()))
try:
pygame.draw.lines(screen, (10, 200, 55), False, combo, POINT_RADIUS)
except ValueError: pass

if self.wait:
screen.blit(font.render(f"Try again in {self.wait_time} seconds", True, (255, 255, 255)), (180, 100))
# Line 25
else:
screen.fill('#7A36B1')
screen.blit(font.render("Unlocked", True, (255, 255, 255)), (245, 400))I tought about using the break function but not sure if it would help. Tried and no success so far.latest?d=yIl2AUoC8zA latest?i=y3W6U5woJi4:5ou_DfgBIis:F7zBnMy latest?i=y3W6U5woJi4:5ou_DfgBIis:V_sGLiP latest?d=qj6IDK7rITs latest?i=y3W6U5woJi4:5ou_DfgBIis:gIN9vFw
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments