倾斜时在屏幕上绘制的垃圾文本
您好,我有一部诺基亚 5800 手机,我正在上面进行一些 pys60 ui 编程。我使用下面的代码来创建箭头。简而言之,draw() 会将箭头绘制到画布表面上。画布连接了 redraw_callback 和 resize_callback 以最终调用 draw() 。但在倾斜时,我在屏幕上得到一些随机文本(垃圾)输出。
import appuifw
from appuifw import *
import e32
from graphics import *
def up(dummy):
appuifw.note(u'Button 1 Clicked', 'note')
def down(dummy):
appuifw.note(u'Button 2 Clicked', 'note')
appuifw.app.screen = 'normal'
def on_resize(dummy):
draw()
def on_redraw(dummy):
draw()
def on_exit():
global lock
lock.signal()
def draw():
global canvas
canvas.clear()
canvas.polygon((20,20,20,60,40,40,20,20), fill=(255,0,0), width=10)
canvas = appuifw.Canvas(resize_callback=on_resize, redraw_callback=on_redraw)
lock = e32.Ao_lock()
appuifw.exit_key_handler = on_exit
draw()
lock.wait()
这是我将手机直举时的样子。
下面是我倾斜它时的样子。
Hi I have a nokia 5800 phone on which I was doing some pys60 ui programming. I used the below code to create the arrow. In short the draw() will draw the arrow onto the canvas surface. The canvas has redraw_callback and resize_callback hooked up to call draw() eventually. But on tilting I get some random text (garbage) output on the screen.
import appuifw
from appuifw import *
import e32
from graphics import *
def up(dummy):
appuifw.note(u'Button 1 Clicked', 'note')
def down(dummy):
appuifw.note(u'Button 2 Clicked', 'note')
appuifw.app.screen = 'normal'
def on_resize(dummy):
draw()
def on_redraw(dummy):
draw()
def on_exit():
global lock
lock.signal()
def draw():
global canvas
canvas.clear()
canvas.polygon((20,20,20,60,40,40,20,20), fill=(255,0,0), width=10)
canvas = appuifw.Canvas(resize_callback=on_resize, redraw_callback=on_redraw)
lock = e32.Ao_lock()
appuifw.exit_key_handler = on_exit
draw()
lock.wait()
Here is how it looks when I've held the phone straight up.
Here is how it looks when I've tilted it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请注意,包含文本的空间(在陆地空间中)是宽度大小减去方向为纵向时的宽度。您是否忘记调整画布大小以适应景观的新尺寸?
看起来文本是控制台输出,检查未定义的内容以及那里正在输出的其他内容。
Note that the space that has the text (in landspace) is the size of the width minus the width it was when the orientation was portrait. Are you forgetting to resize the canvas to the landscape new dimentions?
It seems the text is the console output, check what is not being defined and whatever else is being output there.
甚至:
or even: