zixing131 / Pys60_Simulator

Pys60_Simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

我以前写的pys60的程序都无法运行,兼容性差了点,不过很厉害你那些程序

ataft7 opened this issue · comments

你可以把你的程序发给我,我改一下兼容性。

对图形界面的兼容比文本界面要好一些

这是一个图形菜单的测试程序
import appuifw,e32
from graphics import*
def cn(x):return x.decode("u8")
canvas=appuifw.Canvas()
appuifw.app.body=canvas
run=1
img=Image.new((240,320))
img.clear(0)
print dir(img)
x=0
y=0
list=["菜单一","菜单二","菜单三"]
#Lang
def app():
img.rectangle((0,80,80,140), 0x222299,fill=0x009110,width=2)
img.rectangle((0,y+80,
80,y+100),0x666666,
fill=0x002233)
for i in range(len(list)):
img.text((10,100+20*i),cn(list[i]),0x990000)
img.rectangle((y+50,30,
y+90,60),0x002255)
def press():
global y
if y==0:
appuifw.note(cn(list[0]))
if y==20:
appuifw.note(cn(list[1]))
if y==40:
appuifw.note(cn(list[2]))

def Move(a,b):
global x,y
x+=a
y+=b
if y>40:y=0
if y<0:y=40

def Menu():
while 1:
img.clear(0)
app()
canvas.blit(img)
e32.ao_yield()

canvas.bind(63497,lambda:Move(20,-20))
canvas.bind(63498,lambda:Move(-20,20))
canvas.bind(63557,lambda:press())

Menu()

#lock.wait()

test
这是我运行的结果,不知道和预期相差多少

我基本测试了一下我的脚本,你的模拟器文件夹里面没有的模块是无法运行的,我这边按键没有反应,canvas.blit() 这个函数的坐标参数不能用,有些内容无法显示。
1

1
图片的gif的

你尝试更新一下代码,我这里按键是没问题的,另外没有的模块可以先建立个空文件替代。

2
4

以前写了很多这些小东西,现在看起来很弱鸡,O(∩_∩)O哈哈~