Can you debug this code and tell me what I am doing wrong here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you debug this code and tell me what I am doing wrong here?

This script is supposed to flash a screen with two checkboxes, both checked by default, one for UN, one for pw, asking the user which ones they want a random set of characters generated for, then they click generate, then either one or both are automatically copied to the clipboard. I think I am getting tripped up because both can't be copied maybe? I am sure they can be somehow, but I am doing it wrong probably.

25th Sep 2023, 9:47 PM
James Nesbitt Jr
James Nesbitt Jr - avatar
1 Answer
+ 1
James N unfortunately the python playground here itself can not do the same as with tkinter or other online environments however with that being said ... You can do something like: btn_un = input() btn_pw = input() You would then define 3 functions as say char1(): and char2(): and a 3rd as say to_copy(): def to_copy(): "Whatever you intend to be copied sent to screen or in this case console to be copied" def char1(): "Blocks to create according to what you want" to_copy() def char2(): "Blocks to create according to what you want" to_copy() This is in no way perfect to what you are describing but a plausible way here. if btn_un == "yes" and btn_pw == "no": char1() elif btn_un == "no" and btn_pw == "yes": char2() else: print("No input was introduced")
25th Sep 2023, 11:14 PM
BroFar
BroFar - avatar