手机qpython3 如何画图_Android QPython3 可视化-命令菜单:RadioCmd.py

#需要BaseWindow.py

from BaseWindow import *

RB="""

android:id="@+id/Radio%s"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text="%s"

android:background="#%s"

/>

"""

XML="""<?xml version="1.0" encoding="utf-8"?>

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#3f7faf"

android:orientation="vertical"

xmlns:android="http://schemas.android.com/apk/res/android">

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical"

android:layout_weight="20">

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical"

android:layout_weight="20">

android:id="@+id/Title"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="9dp"

android:text="%s"

android:textColor="#ffffff"

android:textStyle="bold"

android:layout_weight="1"

android:gravity="center"

/>

android:id="@+id/RadioGroup"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical">

""","""

android:layout_width="fill_parent"

android:layout_height="60dp"

android:text="%s"

android:id="@+id/but_canc"

android:textSize="8dp"

android:background="#007f00"

android:textColor="#ffffff"

android:layout_weight="1"

android:gravity="center"/>

"""

class MainScreen(Layout):

def on_show(self):

v=self.views

for i in range(self.Count):

c=v['Radio%s'%i]

c.add_event(click_EventHandler(c,self.conf))

v.but_canc.add_event(click_EventHandler(v.but_canc,self.canc))

def on_close(self):

pass

def conf(self,view,dummy):

MainScreen.Text=int(dummy['data']['id'][5:])

FullScreenWrapper2App.close_layout()

def canc(self,view,dummy):

MainScreen.Text=None

FullScreenWrapper2App.close_layout()

def RadioCmd(Title='',Radio=(),Cancel='取消'):#主函数

#命令按钮组(标题,命令按钮文本组(命令按钮0,命令按钮1,……),取消按钮文本)

#点击“命令按钮n”返回整数n,点击“取消”返回None

r=[XML[0]%Str2Xml(Title)];i=-1

for i in range(len(Radio)):

r.append(RB%(i,Str2Xml(Radio[i]),cmColor[i%2]))

MainScreen.Count=i+1

r.append(XML[1]%Cancel)

r=''.join(r)

FullScreenWrapper2App.show_layout(MainScreen(r,'Cmd'))

FullScreenWrapper2App.eventloop()

r=MainScreen.Text

del MainScreen.Text

return r

__all__=('RadioCmd','droid')

==========说明===========

2a8d0170a1eb2368e5f4dd56c4c3d3824948f71b.jpgRadioCmd('标题',('项目0','项目1','项目2'))

点击“项目n”返回整数n,点击“取消”返回None

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值