Hello,
here is a thing, i'm beginner at wxPython ant Pyhton too. I have written small program here is a example:
import wx
import urllib2
import re
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(600,400))
self.panel=wx.Panel(self)
self.areaa = wx.TextCtrl(self.panel, pos=(0,10), size=(400, 20))
self.area = wx.TextCtrl(self.panel, style = wx.MULTIPLE, pos=(0,50), size=(400,250))
self.pirmas=wx.Button(self.panel, label="Parodyk", pos=(420, 10), size=(100,20))
self.Bind(wx.EVT_BUTTON, self.aaa, self.pirmas)
def aaa (self, event):
response = urllib2.urlopen(self.areaa)
html = response.read()
failas = open("failas.txt", 'w')
failas.write(html)
failas.close()
failas = open("failas.txt", 'r')
regex = re.compile ('http://someurl.*?<')
for line in failas:
g = regex.findall(line)
for word in g:
print (word)[:-1]
failas.close()
app = wx.PySimpleApp()
frm = MyFrame(None, "Simple Program")
frm.Show()
app.MainLoop()
programs starts fine, but then i input something in areaa box i get this error message
Traceback (most recent call last):
File "C:\Python27\11.py", line 19, in aaa
response = urllib2.urlopen(self.areaa)
File "C:\Python27\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 384, in open
protocol = req.get_type()
AttributeError: 'TextCtrl' object has no attribute 'get_type'
What should i change about program to work. I need to input url address and then program grabs it's html and so on..
one more question, how to show the results in area box (that list of links)?
P.S on what highest python version wxpython works?
Thank You.