- OpenCV 4 with Python Blueprints
- Dr. Menua Gevorgyan Arsen Mamikonyan Michael Beyeler
- 131字
- 2021-06-24 16:50:01
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.
推薦閱讀
- Spring 5.0 By Example
- Beginning C++ Game Programming
- VSTO開發(fā)入門教程
- 深度學習:算法入門與Keras編程實踐
- Mastering Ext JS
- The HTML and CSS Workshop
- Mastering JavaScript Design Patterns(Second Edition)
- 從零開始:C語言快速入門教程
- C語言程序設計教程
- Java Web入門很輕松(微課超值版)
- 高性能MVVM框架的設計與實現(xiàn):San
- Learning SaltStack(Second Edition)
- Instant AutoIt Scripting
- C/C++程序設計教程:面向過程分冊
- 天天學敏捷:Scrum團隊轉型記