python3 窗体_Android QPython3 可视化-输出窗体:Output.py

#需要BaseWindow.py

from BaseWindow import *

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

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#9f5f00"

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/editNew"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text=""

android:textColor="#0000ff"

android:layout_weight="1"

/>

android:id="@+id/editOld"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text=""

android:textColor="#ff0000"

android:layout_weight="1"

/>

android:layout_width="fill_parent"

android:layout_height="100dp"

android:orientation="horizontal"

android:layout_weight="8">

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:text="继续(保留)"

android:id="@+id/but_conf"

android:textSize="8dp"

android:background="#2f3f8f"

android:textColor="#ffffffff"

android:layout_weight="1"

android:gravity="center"/>

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:text="复制"

android:id="@+id/but_copy"

android:textSize="8dp"

android:background="#7f7f00"

android:textColor="#ffffffff"

android:layout_weight="1"

android:gravity="center"/>

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:text="继续(清除)"

android:id="@+id/but_canc"

android:textSize="8dp"

android:background="#6f1f6f"

android:textColor="#ffffffff"

android:layout_weight="1"

android:gravity="center"/>

"""

class MainScreen(Layout):

def on_show(self):

self.views.but_conf.add_event(click_EventHandler(self.views.but_conf,self.conf))

self.views.but_copy.add_event(click_EventHandler(self.views.but_copy,self.copy))

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

self.views.editNew.text=clbr(self.New)

global First

if First:

self.views.editOld.text=First

First=None

else:

self.views.editOld.text=clbr(self.Old)

MainScreen.Old=self.Old+self.New

MainScreen.New=''

def on_close(self):

pass

def copy(self,view,dummy):

droid.setClipboard(self.Old)

droid.makeToast("文本已复制")

def conf(self,view,dummy):

FullScreenWrapper2App.close_layout()

def canc(self,view,dummy):

MainScreen.Old=''

FullScreenWrapper2App.close_layout()

Old='';New=''

def clbr(x):

#去掉头尾空行

t=True

while t:

t=False

if x and x[0]=='\n':

x=x[1:]

t=True

if x and x[-1]=='\n':

x=x[:-1]

t=True

return x

First='上/蓝:最新输出\n下/红:历史输出\n这是标准输出窗口\n此提示只显示一次'

def Output(Content=''):#主函数

#输出窗体(内容str)

#不会自动换行

#输出:None

MainScreen.New=Content

FullScreenWrapper2App.show_layout(MainScreen(XML,'Output'))

FullScreenWrapper2App.eventloop()

__all__=('Output','droid')

Output('测试\n内容')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值