This def
is my script that scans a website for active links. In this case, I wanted to know how to get this data and put it on the Pysimplegui
OUTPUT screen.
import PySimpleGUI as sg
import requests
from bs4 import BeautifulSoup
import re
sg.theme( 'Reddit' )
def prog() :
r = requests.get( 'http://www.google.com' )
html = r.text
soup = BeautifulSoup( html , 'lxml' )
links = soup.find_all( 'a' , attrs={'href' : re.compile( '^http://)' )} )
for link in links :
href = link['href']
return href
layout = [
[sg.Output( size=(30 , 20) , key='For_EXIT' )] ,
[sg.Button( 'Read' ) , sg.Exit( )]
]
window = sg.Window( 'SCRIPT' ).layout( layout )
Button , values , event = window.read( )
enter = prog( ) and enter in values['For_EXIT']
print(f'enter: ['-IN-']')