- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
这似乎是windows特有的,这里有一个重现效果的例子:
import wx
def makegrid(window):
grid = wx.GridSizer(24, 10, 1, 1)
window.SetSizer(grid)
for i in xrange(240):
cell = wx.Panel(window)
cell.SetBackgroundColour(wx.Color(i, i, i))
grid.Add(cell, flag=wx.EXPAND)
class TestFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent)
makegrid(self)
class TestDialog(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent)
makegrid(self)
class Test(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None)
btn1 = wx.Button(self, label="Show Frame")
btn2 = wx.Button(self, label="Show Dialog")
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
sizer.Add(btn1, flag=wx.EXPAND)
sizer.Add(btn2, flag=wx.EXPAND)
btn1.Bind(wx.EVT_BUTTON, self.OnShowFrame)
btn2.Bind(wx.EVT_BUTTON, self.OnShowDialog)
def OnShowFrame(self, event):
TestFrame(self).Show()
def OnShowDialog(self, event):
TestDialog(self).ShowModal()
app = wx.PySimpleApp()
app.TopWindow = Test()
app.TopWindow.Show()
app.MainLoop()
我已经在以下配置上尝试过:
wxDialog 不仅在 Ubuntu 上很慢。
最佳答案
我在 wxPython-users mailing list 上收到了回复,可以通过在显示对话框之前显式调用 Layout
来解决此问题。
This is really weird...
My guess is that this is due to Windows and wxWidgets not dealing very well with overlapping siblings, and so when the sizer is doing the initial layout and moving all the panels from (0,0) to where they need to be that something about the dialog is causing all of them to be refreshed and repainted at each move. If you instead do the initial layout before the dialog is shown then it is just as fast as the frame.
You can do this by adding a call to window.Layout() at the end of makegrid.
-- Robin Dunn
关于python - 为什么 wxGridSizer 在 wxDialog 上的初始化比在 wxFrame 上的初始化慢得多?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1198067/
我正在使用以下调用创建一个 wxFrame: new wxFrame(NULL,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxCAP
我想要一个垂直滚动条贯穿框架(顶部 block )。我能够获得各个面板的垂直滚动条 - 这里的两个图都是 threads由相同的 class 绘制. 这是在gnuradio中设置顶部 block 的代
如何将图标(.ico 文件)添加到 wxFrame? 我在看 docs但找不到任何提及 icon . 谢谢! 最佳答案 凤凰wxpython: frame.SetIcon(wx.Icon("path/
我有一个 wxFrame接收事件。每当发生事件时,我都希望将框架置于前台。 我目前正在使用: my_frame->SetFocus(); 但这似乎不适用于最小化的帧。如何将框架设置为事件窗口并将其置于
我有一段非常简单的代码来为我的 wxFrame 设置三倍大的字体: MainWin::MainWin() : wxFrame(NULL, wxID_ANY,wxEmptyString,
我想创建关闭时不会被销毁的 wxFrame,这样我可以稍后再显示它们,并且即使它们被隐藏也可以继续更新它们。 我尝试使用 SetExtraStyle(wxWS_EX_BLOCK_EVENTS) 希望它
如何获取子对话框中的父wxFrame指针 我编写了一个程序来实现一些功能。我有一个 wxFrame、wxMenubar、wxScrolledWindow、wxListBox。通过点击菜单栏的一些菜单,
我一直在网上搜索并试图找出是否有可能在 wxWidgets 的实际 wxFrame 元素中捕获鼠标事件。各种消息来源说这是不可能的,应该使用 wxPanels 来捕获事件,是这样吗? 谢谢 最佳答案
我正在创建带有用户界面的简单 C++ 应用程序。我已经用所需的机制编写了自己的类,现在我必须使用 wxWidgets 显示它的一些组件。 MyApp 包含该类的对象,但在处理事件时,MyFrame 中
我有一个 wxDialog,我在其中打开了一个 wxFrame。现在我想知道 wxFrame 何时关闭,所以我可以在对话框调用者中做一些事情 [在框架上我修改了对话框中也存在的列表,我需要更新它(使用
正如听起来的那样。我在 Wx.Frame 中有一些动态创建的按钮,我希望父框架在添加新按钮时增加高度。高度已经通过按钮总数乘以等于每个按钮高度的整数来获取,但我不知道如何让框架在添加新按钮时根据该值更
我有一个 MainFrame,为了设置背景图片,我实现了自己的 OnPaint() 函数。 OnPaint(wxPaintEvent& roEvent) { if (!m_oBackgorun
我有一个从 wxFrame 派生的 MainFrame。该框架有一个自定义类的面板成员 m_panel,派生自 wxPanel。 我重载了 MainFrame 的 OnPaint() 函数来设置背景图
我有一个带有 3 个按钮的简单 wxFrame。在我按下 Tab 之后什么也没有发生。在论坛上我发现wxFrame应该可以正常处理Tab按钮事件,并在控件之间切换焦点。我尝试了 wxTAB_TRAVE
在 wxGTK 下,事件窗口没有从 IsActive() 返回真值。 我的软件有一个主窗口和一组工具窗口,都是从wxFrame派生出来的。当主窗口移动时,它会捕获移动事件并在所有工具窗口中调用位置方法
我正在尝试调试此代码,框架不会在按下“x”按钮时关闭,但是当我注释掉 wxTimer 时,我可以关闭它。谷歌搜索后我发现了这个 - http://wiki.wxpython.org/Timer我尝试将
我是 C++ 新手,也是 Codelite 新手,也是 wxCrafter 新手。我正在尝试构建一些 GUI 应用程序,但我对 C++ 中的对象传递感到困惑。我花了几个小时,我才明白一点。首先,要在
我的应用程序有一个 GUI,它首先读取一个初始化文件,然后决定有多少控制对象(例如,wxTextCtrl、wxToggleButton 等)需要添加到一个 wxFrame。当wxFrame上的对象过多
是否有可能使 wxFrame 对象表现得像模态对话框,因为创建 wxFrame 对象的窗口会停止执行,直到 wxFrame 对象退出? 我正在研究 small game并遇到了以下问题。我有一个托管主
我正在使用 wxGlade 设计器为小型应用程序生成 GUI。它生成一个继承自 wxFrame 的类,它是主应用程序窗口。为了方便维护,我想避免在这个生成的类中编写额外的代码。 但所有使用 wxGla
我是一名优秀的程序员,十分优秀!