五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Android QPython3H 代碼:制作簡易GUI長文本框界面+控制臺顯示彩色文本

2020-03-22 10:13 作者:乘著船  | 我要投稿

#QPython 3C 現(xiàn)已支持 Python 3.11?→ https://www.bilibili.com/read/cv13418026

#QPython3H/3C 制作簡易GUI長文本框界面

#函數(shù)代碼部分:

from androidhelper import Android
droid = Android()
from qsl4ahelper.fullscreenwrapper2 import * 
XML="""<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	android:layout_width="fill_parent"
	android:layout_height="fill_parent"
	android:background="#ff0E4200"
	android:orientation="vertical"
	xmlns:android="http://schemas.android.com/apk/res/android">
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:orientation="vertical"
		android:layout_weight="20">
	<ScrollView ? 
 ?android:layout_width="fill_parent" ? 
 ?android:layout_height="fill_parent" > 
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:orientation="vertical"
		android:layout_weight="20">	
 <EditText
 ?android:background="#ffffaf"
		android:id="@+id/editTitle"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:textSize="8dp"
		android:text=""
		android:textColor="#ff0000"
		android:layout_weight="1"
		android:gravity="center"
	/>
	<EditText
 ?android:background="#ffffff"
		android:id="@+id/editText"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:textSize="8dp"
		android:text=""
		android:textColor="#0000ff"
		android:layout_weight="1"
	/>
	</LinearLayout>
	</ScrollView>
 ? ?</LinearLayout>
	<LinearLayout
		android:layout_width="fill_parent"
		android:layout_height="100dp"
		android:orientation="horizontal"
		android:layout_weight="8">
	<Button
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:text="%s"
		android:id="@+id/but_conf"
		android:textSize="8dp"
		android:background="#007f7f"
		android:textColor="#ffffffff"
		android:layout_weight="1"
		android:gravity="center"/>
	<Button
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:text="%s"
		android:id="@+id/but_copy"
		android:textSize="8dp"
		android:background="#7f7f00"
		android:textColor="#ffffffff"
		android:layout_weight="1"
		android:gravity="center"/>
	<Button
		android:layout_width="fill_parent"
		android:layout_height="fill_parent"
		android:text="%s"
		android:id="@+id/but_canc"
		android:textSize="8dp"
		android:background="#7f007f"
		android:textColor="#ffffffff"
		android:layout_weight="1"
		android:gravity="center"/>
	</LinearLayout>
</LinearLayout>"""
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.editText.text=self.Text
 ? ? ? ?self.views.editTitle.text=self.Title
 ? ?def on_close(self):
 ? ? ? ?pass
 ? ?def copy(self,view,dummy):
 ? ? ? ?droid.setClipboard(self.views.editText.text)
 ? ? ? ?droid.makeToast("文本已復制")
 ? ?def conf(self,view,dummy):
 ? ? ? ?MainScreen.Text=self.views.editText.text
 ? ? ? ?FullScreenWrapper2App.close_layout()
 ? ?def canc(self,view,dummy):
 ? ? ? ?MainScreen.Text=None
 ? ? ? ?FullScreenWrapper2App.close_layout()
def LongText(Title='',Text='',button=('確認','復制','取消')):#主函數(shù)
#長文本(標題,多行文本,(確認按鈕文本,復制按鈕文本,取消按鈕文本))
#替代系統(tǒng)輸入函數(shù):input=LongText
 ? ?MainScreen.Title=Title
 ? ?MainScreen.Text=Text
 ? ?FullScreenWrapper2App.show_layout(MainScreen(XML%tuple(button),'Long'),
 ? ? ? ?FullScreenWrapper2App.SHOW_LAYOUT_REPLACING_CURRENT)
 ? ?FullScreenWrapper2App.eventloop()
 ? ?i=MainScreen.Text
 ? ?del MainScreen.Title,MainScreen.Text
 ? ?return i
FullScreenWrapper2App.initialize(droid)
__all__=('LongText','droid')

#舉個例子:

input('按回車鍵繼續(xù)1:')
print(LongText('測試1','文字1'))
input('按回車鍵繼續(xù)2:')
print(LongText('測試2','文字2'))

#Bilibili?AV97477124 part1

#最后修改:2021-10-21

#可視化GUI長文本框界面新寫法(LongText.py):

#https://www.bilibili.com/read/cv7630909

#QPython 3H/3C?控制臺顯示彩色文本

#函數(shù)代碼部分:

import sys
#數(shù)值表示的參數(shù)含義:
#顯示方式:0(默認值),1(高亮),22(非粗體),4(下劃線),24(非下劃線),5(閃爍),25(非閃爍),7(反顯),27(非反顯)
#前景色:30(黑色),31(紅色),32(綠色),33(黃色),34(藍色),35(洋紅),36(青色),37(白色)
#背景色:40(黑色),41(紅色),42(綠色),43(黃色),44(藍色),45(洋紅),46(青色),47(白色)
Colors={
'不存在':'1;33;41',
'找不到':'1;33;44',
'出錯':'1;31;43',
'導出':'7;33;40',
'修改':'1;34;43',
'姓名':'1;34;47',
'病號':'1;31;47',
'藥':'1;32;40',
'回車':'1;37;45',
'數(shù)據(jù)庫':'1;35;46',
}
_out1=sys.stdout.write
_out4=sys.stdout.flush
def _out2(i=''):
 ? ?for j in Colors:
 ? ? ? ?if j in i:
 ? ? ? ? ? ?i='\033[%sm%s\033[0m'%(Colors[j],i)
 ? ? ? ? ? ?break
 ? ?else:
 ? ? ? ?i='\033[1;36;40m%s\033[0m'%i
 ? ?_out1(i)
class _out3:
 ? ?flush=_out4
 ? ?write=_out2
sys.stdout=sys.stderr=_out3

#舉個例子:

print('這是一個數(shù)據(jù)庫')
print('藥品信息查詢')
print('病號管理')
print('Python版本:'+sys.version)

#Bilibili?AV97477124 part2

#最后修改:2021-10-21


作者:乘著船@Bilibili

更多文章+下載鏈接:https://www.bilibili.com/read/readlist/rl321663


Android QPython3H 代碼:制作簡易GUI長文本框界面+控制臺顯示彩色文本的評論 (共 條)

分享到微博請遵守國家法律
金乡县| 乐都县| 平顶山市| 金华市| 扎囊县| 二手房| 普兰店市| 武清区| 长丰县| 长宁区| 珲春市| 冕宁县| 罗山县| 渝北区| 历史| 铁力市| 博野县| 襄城县| 泗阳县| 北宁市| 长岭县| 拉孜县| 中卫市| 洪雅县| 五寨县| 舒城县| 武穴市| 定日县| 宜宾市| 呼玛县| 临西县| 工布江达县| 大冶市| 南和县| 平阴县| 呼和浩特市| 新泰市| 彭山县| 剑川县| 峨眉山市| 曲周县|