>>>import urllib
>>>urllib.urlopen('http://www.hojko.com').info()
ucim sa python tak som si to chcel spravit v Tkinter a napisal som to takto :
Kód: Vybrať všetko
from Tkinter import *
import urllib
okno=Tk()
okno.title('infoweb')
vstupy = [IntVar() for n in range(1)]
vystup = StringVar()
for vstup in vstupy:
Entry(textvariable = vstup).pack(fill=X)
Label(textvariable = vystup).pack(fill=X)
def display():
vystup.set('wrong')
a = vstupy[0].get()
Inform = urllib.urlopen('a').info();
vystup.set(Inform)
display = Button(text = 'display', command = display)
display.pack(fill=BOTH)
okno.mainloop()Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
File "/media/1CE84E98E84E7056/download/programming/python/vylepsene/infoweb.py", line 15, in display
a = vstupy[0].get()
File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 286, in get
return getint(self._tk.globalgetvar(self._name))
ValueError: invalid literal for int() with base 10: "http://www.hojko.com/'"
neviem si s tym poradit, myslim ze chyba je v tychto dvoch riadkoch :
Kód: Vybrať všetko
a = vstupy[0].get()
Inform = urllib.urlopen('a').info();