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

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

Android QPython3 可視化-圖像文本:ImageText.py

2020-10-27 12:13 作者:乘著船  | 我要投稿

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


from BaseWindow 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:id="@+id/Title"

? android:layout_width="fill_parent"

? android:layout_height="wrap_content"

? android:textSize="8dp"

? android:text=""

? android:textColor="#ff0000"

? android:layout_weight="0"

? android:gravity="center"

?/>

?<EditText

? android:id="@+id/Text"

? android:layout_width="fill_parent"

? android:layout_height="wrap_content"

? android:textSize="8dp"

? android:text=""

? android:textColor="#0000ff"

? android:layout_weight="0"

?/>

""","""

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

IV=''' <ImageView

? android:id="@+id/Image%s"

? android:layout_width="fill_parent"

? android:layout_height="0dp"

? android:layout_weight="1"

? android:adjustViewBounds="true"

? android:scaleType="fitXY"

?/>'''

class MainScreen(Layout):

? ? def on_show(self):

? ? ? ? v=self.views

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

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

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

? ? ? ? v['Title'].text=self.Title

? ? ? ? v['Text'].text=self.Text

? ? ? ? c=self.Count

? ? ? ? i=self.Images

? ? ? ? for c in range(c):

? ? ? ? ? ? v['Image%s'%c].src=i[c]

? ? def on_close(self):

? ? ? ? pass

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

? ? ? ? droid.setClipboard(self.views.Text.text)

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

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

? ? ? ? MainScreen.Text=self.views.Text.text

? ? ? ? FullScreenWrapper2App.close_layout()

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

? ? ? ? MainScreen.Text=None

? ? ? ? FullScreenWrapper2App.close_layout()

def ImageText(Title='',Text='',Images='',button=CCC):#主函數(shù)

#圖像長文本(標(biāo)題,多行文本,圖像文件名列表,(確認(rèn)按鈕文本,復(fù)制按鈕文本,取消按鈕文本))

? ? i=type(Images)

? ? if i==str:

? ? ? ? Images=[Images,]

? ? elif i==tuple:

? ? ? ? Images=list(Images)

? ? a=[XML[0]]

? ? for i in range(len(Images)):

? ? ? ? if Images[i].find('://')==-1:

? ? ? ? ? ? Images[i]='file://'+Images[i]

? ? ? ? a.append(IV%i)

? ? MainScreen.Images=Images

? ? MainScreen.Count=i+1

? ? MainScreen.Title=Title

? ? MainScreen.Text=Text

? ? a.append(XML[1]%button)

? ? FullScreenWrapper2App.show_layout(MainScreen('\n'.join(a),'Image'))

? ? FullScreenWrapper2App.eventloop()

? ? i=MainScreen.Text

? ? del MainScreen.Text,MainScreen.Title,MainScreen.Count,MainScreen.Images

? ? return i

__all__=('ImageText','droid')


tb='/sdcard/Pictures/taobao/'
tb=(tb+'-1140137267.jpg',tb+'1379905288.jpg')
txt='白巧克力\n黑巧克力'
txt=ImageText('淘寶圖片',txt,tb)
print(txt)
按“確認(rèn)”后打印的內(nèi)容

另,更改背景圖片的方法:

1.全Activity或大范圍更改

<LinearLayout

?android:background="file:///sdcard/……/xxx.jpg"

?#其他內(nèi)容# >

2.小控件更改

?<EditText

?android:background="file:///sdcard/……/xxx.jpg"

?#其他內(nèi)容#

?/>


作者:乘著船@Bilibili

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


Android QPython3 可視化-圖像文本:ImageText.py的評(píng)論 (共 條)

分享到微博請遵守國家法律
油尖旺区| 泽州县| 临泽县| 涟水县| 佛学| 牙克石市| 芦山县| 贵南县| 嫩江县| 濮阳县| 鲁甸县| 澎湖县| 洪湖市| 南岸区| 丰台区| 襄樊市| 汉中市| 合肥市| 吉安市| 新乡县| 利津县| 蕉岭县| 大新县| 资兴市| 平原县| 如东县| 施甸县| 沐川县| 金堂县| 虞城县| 沂水县| 蛟河市| 武夷山市| 枞阳县| 衡水市| 建昌县| 巢湖市| 鄂尔多斯市| 格尔木市| 赤水市| 来安县|