wxpythonに問題があります。次のコードを実行すると、リストボックスが小さなフォームで表示されます(リストボックスは約10x10で表示されます)。私はなぜこれが起こっているのか分かりませんし、オンラインでこれを手助けするリソースがあまりありません。私はボタンを追加しないと、リストボックスが正しく表示されます。私はそれが簡単な修正ですが、私は本当に困っています。私の問題が何かを理解できない場合は、次のコードを実行してください。wxpython、基本的なUIエラー、ボタンとリストボックスの競合?
import wx
class MyFrame(wx.Frame):
"""make a frame, inherits wx.Frame"""
def __init__(self,parent,id):
# create a frame, no parent, default to wxID_ANY
wx.Frame.__init__(self, parent, id, 'Testing',
pos=(300, 150), size=(600, 500))
panel = wx.Panel(self)
sampleList = ['dsakdsko0', '1', '2', '3', '4']
listBox = wx.ListBox(panel, -1, (4,3), (100, 60), sampleList, wx.LB_SINGLE)
listBox.SetSelection(3)
self.SetBackgroundColour("white")
wx.Button(self, 1, 'Close', (50, 130))
wx.Button(self, 2, 'Random Move', (150, 130), (110, -1))
self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)
self.Bind(wx.EVT_BUTTON, self.OnRandomMove, id=2)
# show the frame
self.Show(True)
#menu bar
status=self.CreateStatusBar()
menubar=wx.MenuBar()
first=wx.Menu()
second=wx.Menu()
first.Append(wx.NewId(),"New","Creates A new file")
first.Append(wx.NewId(),"ADID","Yo")
menubar.Append(first,"File")
menubar.Append(second,"Edit")
self.SetMenuBar(menubar)
def OnClose(self, event):
self.Close(True)
def OnRandomMove(self, event):
screensize = wx.GetDisplaySize()
randx = random.randrange(0, screensize.x - APP_SIZE_X)
randy = random.randrange(0, screensize.y - APP_SIZE_Y)
self.Move((randx, randy))
if __name__=='__main__':
application = wx.PySimpleApp()
frame=MyFrame(parent=None,id=-1)
frame.Show()
# start the event loop
application.MainLoop()
ありがとうございました。
おかげで、しかし、私はまだこれに少し新しいです、あなたはそれが –
おかげでロットをどのように行われるか私を見ることができます!!!! –