2014-02-21 1 views
0

나는 대화 상자에서 이미지를 시각화하려고하고 있는데, 그 외에도 일부 옵션을 보여주는 droplist가 있습니다. 여기 내 코드는 (모든 날에 의해 정의 된 클래스 내)입니다 :wxPython.Dialog에서 wxPython.Choice를 사용하는 방법?

""" Create main App """ 
self._app = wx.App() 

""" Load image """ 
png = wx.Image('show_work.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() 

""" Create dialog """ 
self._dialog = wx.Dialog(None, -1, 'Graphical Output', size = (png.GetWidth()+25, png.GetHeight()+150), style=wx.DEFAULT_DIALOG_STYLE & ~wx.RESIZE_BORDER) 

""" Bind image to dialog """ 
wx.StaticBitmap(self._dialog, -1, png, (10,5), (png.GetWidth(), png.GetHeight())) 

""" Create choice list """ 
choice_list = [] 
for number in xrange(self._upper_limit): 
    choice_list.append(str(number +1)) 

""" Create choice list """ 
self._droplist = wx.Choice(self._dialog, -1, (280, 200), choices = choice_list) 

""" Show dialog """ 
self._dialog.ShowModal() 

""" Start main App """ 
self._app.MainLoop() 

결과 출력은 이미지가 올바르게 표시되는 것을 보여줍니다. 그러나 내가 만든 드롭 목록은 표시되지 않았습니다. 그리고 나는 그것을 만들기 위해 지정된 positing이 대화 상자의 중앙에 있고 상자를 표시 할 충분한 공간이 있는지 확신합니다.

그래서 내가 위의 덩어리에서 내가 뭘 잘못 알 수 있습니까?

감사합니다.

답변

1

흠이 나

import wx 
class P: 
    def __init__(self): 
     """ Create main App """ 
     self._app = wx.App(redirect=False) 

     #""" Load image """ 
     #png = wx.Image('show_work.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap() 

     """ Create dialog """ 
     self._dialog = wx.Dialog(None, -1, 'Graphical Output', size = (500,500), style=wx.DEFAULT_DIALOG_STYLE & ~wx.RESIZE_BORDER) 

     """ Bind image to dialog """ 
     #wx.StaticBitmap(self._dialog, -1, png, (10,5), (png.GetWidth(), png.GetHeight())) 

     """ Create choice list """ 
     choice_list = [] 
     for number in xrange(10): 
      choice_list.append(str(number +1)) 

     """ Create choice list """ 
     self._droplist = wx.Choice(self._dialog, -1, (280, 200), choices = choice_list) 

     """ Show dialog """ 
     self._dialog.ShowModal() 

     """ Start main App """ 
     self._app.MainLoop() 

P() 
을 위해 잘 작동