English 中文(简体)
wxpython:nes平大小,左上角的小块平方?
原标题:wxpython: nested sizers, and little square in top left corner?

我试图研究轮椅和大小,我举以下例子:

import wx

class MyTestFrame(wx.Frame):
    def __init__(self, parent, title):
        super(MyTestFrame, self).__init__(parent, title=title, 
            size=(250, 150))

        # the master panel of the frame - "Add a panel so it looks correct on all platforms"
        self.panel = wx.Panel(self, wx.ID_ANY)
            # self.panel.SetBackgroundColour(wx.Colour(124, 224, 124)) # to confirm the square is the panel


        # want these buttons absolutely positioned
        btn_A = wx.Button(self, id=1, label= A , pos=(10, 10), size=(30, 30))
        btn_A.SetBackgroundColour(wx.Colour(224, 124, 124))
        btn_B = wx.Button(self, id=2, label= B , pos=(45, 10), size=(30, 30))
        btn_C = wx.Button(self, id=3, label= C , pos=(80, 10), size=(30, 30))

        # additional object

        mastersizer = wx.BoxSizer(wx.VERTICAL)
        btnsizer = wx.BoxSizer(wx.HORIZONTAL)

        btnsizer.Add(btn_A, 0)
        btnsizer.Add(btn_B, 0)
        btnsizer.Add(btn_C, 0)

        mastersizer.Add(btnsizer, 1, wx.EXPAND)
        self.panel.SetSizer(mastersizer)
        #~ mastersizer.Fit(self) # makes the window as large as the buttons

        self.Centre()
        self.Show()


if __name__ ==  __main__ :
    app = wx.App()
    MyTestFrame(None,  Test )
    app.MainLoop()

当我执政时,我就有一个像形象一样的窗口:

“wxPythondow”/

谁能解释,为什么我拿到这块小块地上左上角,什么是执行守则的正确方法? (纽特有色,因此可以明显看出。) 乌班图卢德一米,如果是平台特有的话。

EDIT:这平方显然是小组本身,但我不能说,它为什么会按原意使顿变成母子?

最佳回答

Ah well - wasn t that mis; but wasn t that clear to me : 因此,这里提到了像我这样的其他意见: 根据上述法典,各州的定义是儿童,而不是小组;因此唯一的变化是:

    # want these buttons absolutely positioned
    # must be children of panel - if panel is to encompass them! 
    btn_A = wx.Button(self.panel, id=1, label= A , pos=(10, 10), size=(30, 30))
    btn_A.SetBackgroundColour(wx.Colour(224, 124, 124))
    btn_B = wx.Button(self.panel, id=2, label= B , pos=(45, 10), size=(30, 30))
    btn_C = wx.Button(self.panel, id=3, label= C , pos=(80, 10), size=(30, 30))

那么,看来所有东西都是罚款:

“entergraph

Well好,担心会在这里浪费空间,但希望其他人能够使用:

Cheers!

问题回答

暂无回答




相关问题
Getting value of TextCtrl from a different wxPanel

I was trying to get my first wxWindow application to work and I ran into following difficulty: I create wxPanel and add a wxNotebook object to it. Then I add a page to notebook created from another ...

Displaying OpenCV iplimage data structures with wxPython

Here is my current code (language is Python): newFrameImage = cv.QueryFrame(webcam) newFrameImageFile = cv.SaveImage("temp.jpg",newFrameImage) wxImage = wx.Image("temp.jpg", wx.BITMAP_TYPE_ANY)....

Tree view GUI widget/gui library that can do multiple icons?

Screenshot I m looking to recreate this in Python; I can t find a library that seems to have what I need. Are there any GUI libraries that might possibly have this? - I have scoured wxWidgets (which ...

Alternatives to wx.lib.masked.NumCtrl

In a wxPython application I m developing I need a lot of input fields for numbers (integers and floats), so I tried using wx.lib.masked.NumCtrl, but my users now tell me that it s quite uncomfortable ...

热门标签