salve a tutti e sopratutto Buon Natale!
in questi giorni di festa mi sonon un pò a studiare wxPython.
ho creato questa classe qua:
codice:
# file Form.py
import wx
from wx._controls import Button
class Form(wx.Frame):
def __init__(self):
wx.Frame.__init__(None, title = "Python YoutubeDL", size = (410, 80), style = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)
txtUrl = wx.TextCtrl(self, pos = (5, 5), size = (400, 25))
txtUrl.Bind(wx.EVT_KEY_DOWN, self.loadUrl)
txtUrl.SetFocus()
btnGo = Button(self, label = "Download", pos = (5, 40))
btnGo.Bind(wx.EVT_BUTTON, self.loadUrl)
def loadUrl(self, event):
if event.GetKeyCode() == wx.WXK_RETURN:
if self.txtUrl.GetValue() == "":
wx.MessageBox(parent = self, message = 'Immettere un indirizzo', caption = 'Errore', style = wx.OK ^ wx.ICON_INFORMATION)
else:
event.Skip()
poi ho una file chiamato __init__.py che sto usando come start del programma.
dentro ci ho messo questo:
codice:
import wx
from Form import *
app = wx.App()
f = Form()
f.Show()
app.MainLoop()
ma ottengo questo errore:
codice:
TypeError: unbound method __init__() must be called with Frame instance as first argument (got NoneType instance instead)
mi sapete dire da cosa dipende??