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

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.

主站蜘蛛池模板: 华阴市| 徐水县| 呼玛县| 盐津县| 溧阳市| 梁河县| 盐山县| 东丰县| 寿光市| 洪江市| 惠水县| 拉孜县| 水城县| 岐山县| 航空| 邓州市| 西乌珠穆沁旗| 汉寿县| 鹿泉市| 三明市| 临泽县| 历史| 彭泽县| 揭西县| 阿拉善左旗| 博客| 若尔盖县| 栖霞市| 泰兴市| 岫岩| 南丰县| 阳山县| 六安市| 乌兰浩特市| 平安县| 天长市| 达孜县| 曲阳县| 田阳县| 内丘县| 方正县|