Reputation: 49
I want to start by thanking everyone for taking the time to read this and help me out. IM rand new to pysimplegui and am having a hard time passing this variable into pyperclip. I'm positive my syntax is wrong. The actual line for pyperclip is correct, just not for pysimplegui, any help is appreciated.
import PySimpleGUI as sg
import pyperclip
sg.theme('BluePurple')
layout = [[sg.Text('Enter the Domain and TLD:')],
[sg.Input(key='domain')],
[sg.Input(key='tld')],
[sg.Button('Convert to Regex'), sg.Button('Exit')]]
window = sg.Window('HTTP Regex Maker', layout)
while True: # Event Loop
event, values = window.read()
print(event, values)
if event == sg.WIN_CLOSED or event == 'Exit':
break
if event == 'Convert to Regex':
# Update the "output" text element to be the value of "input" element
pyperclip.copy("^([A-Za-z0-9.-]*\.)?"+domain+"\."+tld)
window.close()
Upvotes: 0
Views: 257
Reputation: 49
I rewrote it slightly and is working now. hoe this helps someone.
import PySimpleGUI as sg
import pyperclip
sg.theme('SandyBeach')
layout = [
[sg.Text('Please enter Domain and TLD')],
[sg.Text('domain', size =(15, 1)), sg.InputText()],
[sg.Text('tld', size =(15, 1)), sg.InputText()],
[sg.Submit(), sg.Cancel()]
]
window = sg.Window('HTTP Regex Maker', layout)
event, values = window.read()
window.close()
pyperclip.copy("^([A-Za-z0-9.-]*\.)?"+values[0]+"\."+values[1])
Upvotes: 1