Question

I am trying to visualize an image in a dialog, and a droplist besides it to show some options. Here is my code (everything is within a class that defined by me):

""" 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()

The resulting output shows that, the image is displayed correctly. However, the drop list I created was not displayed. And I am sure that the positing I specified to create it is in the center of the dialog and there is enough space in the box to display it.

So may I know what am I wrong in the above chunk?

Thanks.

Was it helpful?

Solution

hmm this works fine for me

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()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top