官术网_书友最值得收藏!

Learning about a basic GUI layout

The most basic layout consists of only a large black panel that provides enough room to display the video feed:

        self.video_pnl = wx.Panel(self, size=(self.imgWidth, self.imgHeight))
self.video_pnl.SetBackgroundColour(wx.BLACK)

In order for the layout to be extendable, we add it to a vertically arranged wx.BoxSizer object:

        # display the button layout beneath the video stream
self.panels_vertical = wx.BoxSizer(wx.VERTICAL)
self.panels_vertical.Add(self.video_pnl, 1, flag=wx.EXPAND | wx.TOP,
border=1)

Next, we specify an abstract method, augment_layout, for which we will not fill in any code. Instead, any user of our base class can make their own custom modifications to the basic layout:

        self.augment_layout()

Then, we just need to set the minimum size of the resulting layout and center it:

        self.SetMinSize((self.imgWidth, self.imgHeight))
self.SetSizer(self.panels_vertical)
self.Centre()

The next section shows you how to handle video streams.

主站蜘蛛池模板: 姚安县| 纳雍县| 岱山县| 蒲城县| 广水市| 鄂伦春自治旗| 金门县| 巴青县| 吴桥县| 福贡县| 大洼县| 武胜县| 青田县| 双峰县| 宁晋县| 佛冈县| 芦山县| 思茅市| 彰武县| 贵州省| 天镇县| 民丰县| 绥化市| 宿州市| 丰顺县| 那曲县| 隆子县| 准格尔旗| 百色市| 江达县| 博白县| 星座| 彭泽县| 原平市| 凌海市| 城步| 迭部县| 六枝特区| 广宁县| 武平县| 汽车|