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

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

Android QPython3 可視化-三鍵按鈕:ButtonText.py

2020-09-18 07:44 作者:乘著船  | 我要投稿

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


from BaseWindow import *

BT="""

? ? <Button

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:text="%s"

android:id="@+id/but_yes"

android:textSize="8dp"

android:background="#3f3f7f"

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

android:textSize="8dp"

android:background="#7f3f3f"

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

android:textSize="8dp"

android:background="#7f7f00"

android:textColor="#ffffffff"

android:layout_weight="1"

android:gravity="center"/>

"""

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

<LinearLayout

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#007f7f"

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

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text=""

android:textColor="#0000ff"

android:layout_weight="1"

android:gravity="center"

/>

<EditText

android:id="@+id/editText"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:textSize="8dp"

android:text=""

android:textColor="#ff0000"

android:layout_weight="1"

/>

</LinearLayout>

</ScrollView>

? ? </LinearLayout>

<LinearLayout

android:layout_width="fill_parent"

android:layout_height="100dp"

android:orientation="horizontal"

android:layout_weight="8">

""","""

</LinearLayout>

</LinearLayout>"""

class MainScreen(Layout):

? ? def on_show(self):

? ? ? ? #if self.Count>=0:

? ? ? ? self.views.but_yes.add_event(click_EventHandler(self.views.but_yes,self.yes))

? ? ? ? if self.Count>1:

? ? ? ? ? ? self.views.but_noo.add_event(click_EventHandler(self.views.but_noo,self.noo))

? ? ? ? if self.Count>2:

? ? ? ? ? ? self.views.but_can.add_event(click_EventHandler(self.views.but_can,self.can))

? ? ? ? self.views.editTitle.text=self.Title

? ? ? ? self.views.editText.text=self.Text

? ? def on_close(self):

? ? ? ? pass

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

? ? ? ? MainScreen.Text=1

? ? ? ? FullScreenWrapper2App.close_layout()

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

? ? ? ? MainScreen.Text=-1

? ? ? ? FullScreenWrapper2App.close_layout()

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

? ? ? ? MainScreen.Text=0

? ? ? ? FullScreenWrapper2App.close_layout()

YNC=('是','否','取消')

def ButtonText(Title='',Text='',button=YNC):#主函數(shù)

#三按鈕對(duì)話框(標(biāo)題,內(nèi)容,("是"按鈕文本,"否"按鈕文本,"取消"按鈕文本))

#返回:是=1,否=-1,取消=0

#省按鈕(button)格式:默認(rèn)為("是","否","取消")

#三按鈕(button)格式:("是"按鈕文本,"否"按鈕文本,"取消"按鈕文本)

#二按鈕(button)格式:("是"按鈕文本,"否"按鈕文本)

#單按鈕(button)格式:("是"按鈕文本,)

#空按鈕(button)格式:(),等價(jià)于單按鈕("OK",)

? ? MainScreen.Title=Title

? ? MainScreen.Text=Text

? ? b=[XML[0]]

? ? MainScreen.Count=l=len(button)

? ? if l==3:

? ? ? ? a=(button[0],button[2],button[1])

? ? elif l==2:

? ? ? ? a=(button[0],'',button[1])

? ? elif l==1:

? ? ? ? a=(button[0],'','')

? ? else:#l==0

? ? ? ? a=('OK','','')

? ? for i in range(3):

? ? ? ? if a[i]:

? ? ? ? ? ? b.append(BT[i]%a[i])

? ? b.append(XML[1])

? ? b=''.join(b)

? ? FullScreenWrapper2App.show_layout(MainScreen(b,'Button'))

? ? FullScreenWrapper2App.eventloop()

? ? b=MainScreen.Text

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

? ? return b

__all__=('ButtonText','droid')


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


ButtonText('標(biāo)題','多行\(zhòng)n內(nèi)容')

返回:是=1,否=-1,取消=0

Android 5.0 系統(tǒng)以上,遇到Button英文全部自動(dòng)變?yōu)榇髮懡鉀Q方案:

Button繼承至TextView,把Button改成TextView打回原形就可以了。

例如:

<Button

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

改為:

<TextView

android:clickable="true"

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

作者:乘著船@Bilibili

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



Android QPython3 可視化-三鍵按鈕:ButtonText.py的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
仁怀市| 陇川县| 巴马| 景德镇市| 新建县| 都江堰市| 临猗县| 锦州市| 曲靖市| 晋宁县| 武宁县| 昌图县| 昌都县| 年辖:市辖区| 曲周县| 上蔡县| 安阳市| 响水县| 双牌县| 武陟县| 盐边县| 庆元县| 日喀则市| 龙川县| 齐齐哈尔市| 合水县| 卫辉市| 昭平县| 黄石市| 日喀则市| 堆龙德庆县| 濮阳县| 鄂尔多斯市| 洮南市| 南岸区| 金塔县| 赤壁市| 兖州市| 美姑县| 博罗县| 遂平县|