wxPython:文本对齐不起作用 [英] wxPython: text alignment does not work

查看:27
本文介绍了wxPython:文本对齐不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些原因,wx.ALIGN_* 在 Ubuntu 上没有对齐任何东西,而它在 Mac OS X 上工作:

For some reasons the wx.ALIGN_* does not align anything on Ubuntu, while it works on Mac OS X:

self.static_text = wx.StaticText(self, -1, 'hello, world', pos=(0,0), 
                                 size=(300,30), style=wx.ALIGN_CENTER)

任何想法,可能是什么?

Any idea, what could it be?

更新:这是在 Mac OS X 10.7.2 上使用 wxPython 2.8.12.1 进行的尝试.wxPython 2.8.11.0 在 Ubuntu 11.10 上.

Update: This was tried with wxPython 2.8.12.1 on Mac OS X 10.7.2. wxPython 2.8.11.0 on Ubuntu 11.10.

更新 2:在带有 wxPython 2.8.12.1 的 Debian 6.0.3 上也不起作用

Update 2: Does not work either on Debian 6.0.3 with wxPython 2.8.12.1

更新 3:以上所有内容均使用 Python 2.6 进行测试

Update 3: All of the above was tested with Python 2.6

推荐答案

我在 Win 7 环境下测试了这段代码,发现一个关于参数用法的错误:SyntaxError: non-keyword arg after keyword arg

I have test this code snippet in Win 7 environment, one error is surfaced about the argument usage: SyntaxError: non-keyword arg after keyword arg

self.static_text = wx.StaticText(self, -1, 'hello, world', pos=(0,0), size=(300,30), style = wx.ALIGN_CENTER)

因为你在wx.ALIGN_CENTER前面使用了两个关键字参数(pos"和size"),这是非关键字参数.我想将 wx.ALIGN_CENTER 更改为 style = wx.ALIGN_CENTER 可以解决您的问题吗?

Cause you have used two keyword args ("pos" and "size") in front of wx.ALIGN_CENTER, which is non-keyword arg. I guess that change wx.ALIGN_CENTER into style = wx.ALIGN_CENTER may solve your problem ?

这篇关于wxPython:文本对齐不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆