最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

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

Android QPython3 可視化-多個文本:MultText.py

2020-09-18 03:28 作者:乘著船  | 我要投稿

#需要BaseWindow.py??https://www.bilibili.com/read/cv8680125


from BaseWindow import *

ET="""

<EditText

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

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text="%s"

android:textColor="#ff0000"

android:background="#afffaf"

android:layout_weight="1"

android:gravity="center"

/>

<EditText

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

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text="%s"

android:textColor="#0000ff"

android:layout_weight="1"

/>

"""

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:id="@+id/supTitle"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text="%s"

android:textColor="#007f00"

android:layout_weight="1"

android:gravity="center"

/>

""","""

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

def getText(self):

? ? t=self.text

? ? j=[]

? ? for i in range(self.Count):

? ? ? ? j.append(t[i].text)

? ? return j

class MainScreen(Layout):

? ? def on_show(self):

? ? ? ? v=self.views

? ? ? ? Text=[]

? ? ? ? for i in range(self.Count):

? ? ? ? ? ? Text.append(v.pop('Text%s'%i))

? ? ? ? self.text=Text

? ? ? ? v.but_conf.add_event(click_EventHandler(v.but_conf,self.conf))

? ? ? ? v.but_copy.add_event(click_EventHandler(v.but_copy,self.copy))

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

? ? def on_close(self):

? ? ? ? pass

? ? def copy(self,view,dummy):

? ? ? ? droid.setClipboard(str(getText(self)))

? ? ? ? droid.makeToast("文本已復(fù)制")

? ? def conf(self,view,dummy):

? ? ? ? MainScreen.Text=getText(self)

? ? ? ? FullScreenWrapper2App.close_layout()

? ? def canc(self,view,dummy):

? ? ? ? MainScreen.Text=None

? ? ? ? FullScreenWrapper2App.close_layout()

def MultText(supTitle='',Contents=(),button=CCC):#主函數(shù)

#多段文本(總標題,多段文本標題內(nèi)容(標題1,內(nèi)容1,標題2,內(nèi)容2,……),(確認按鈕文本,復(fù)制按鈕文本,取消按鈕文本))

#按“確認”返回:多段文本內(nèi)容list[內(nèi)容1,內(nèi)容2,……]

#按“取消”返回:None

? ? m=[XML[0]%Str2Xml(supTitle)]

? ? Contents=list(Contents)

? ? j=len(Contents)

? ? if j<1:

? ? ? ? Contents.append('')

? ? ? ? j=1

? ? if j%2:

? ? ? ? Contents.append('')

? ? for i in range(0,j,2):

? ? ? ? k=i>>1

? ? ? ? j=k,Str2Xml(Contents[i]),k,Str2Xml(Contents[i+1])

? ? ? ? m.append(ET%j)

? ? m.append(XML[1]%tuple(button))

? ? m=''.join(m)

? ? MainScreen.Count=k+1

? ? FullScreenWrapper2App.show_layout(MainScreen(m,'Mult'))

? ? FullScreenWrapper2App.eventloop()

? ? m=MainScreen.Text

? ? del MainScreen.Text,MainScreen.Count

? ? return m

__all__=('MultText','droid')


==========說明==========


MultText('大標題',('小標題1','小內(nèi)容1','小標題2','小內(nèi)容2'))

按“確認”返回:['小內(nèi)容1','小內(nèi)容2']


視頻:BV1xt4y1q7Ky

作者:乘著船@Bilibili

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



Android QPython3 可視化-多個文本:MultText.py的評論 (共 條)

分享到微博請遵守國家法律
沙坪坝区| 延安市| 通道| 马公市| 德昌县| 涡阳县| 金山区| 城步| 南丹县| 阜新市| 库车县| 通河县| 公安县| 武冈市| 旺苍县| 东乌珠穆沁旗| 区。| 东海县| 宁南县| 榆林市| 蓝山县| 浮山县| 甘南县| 皮山县| 定结县| 株洲市| 太谷县| 凤凰县| 灵山县| 台北市| 福鼎市| 壤塘县| 宣武区| 海宁市| 依兰县| 南皮县| 浦东新区| 大姚县| 嘉义市| 会泽县| 常熟市|