LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-10-2021, 04:49 PM   #1
Arch4GoodieLike
Member
 
Registered: Sep 2020
Location: Cave
Distribution: Arch Linux
Posts: 143

Rep: Reputation: Disabled
Post [Python] restart once screenlock has been unlocked


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.
 
Old 12-14-2021, 07:22 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Thanks for reposting your question with minimal example code, much appreciated. Per your request to delete this thread: It is a complete question which has been visible for four days so it is possible others are now considering a response and it would be disrespectful of their time to remove the question, so let's keep it open.

My own python skills are nearly non-existent so I am unable to offer help myself - good luck!
 
  


Reply

Tags
programming, pygame, python



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My web server has been hacked. SU password has been disabled rcrosoer Linux - Security 11 06-27-2008 02:18 PM
shortcut for screenlock tincat2 Linux - General 1 03-29-2004 05:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration