什么是有效的appJar拉伸函数参数

2024-10-01 22:34:40 发布

您现在位置:Python中文网/ 问答频道 /正文

到目前为止,我一直在尝试用python创建一个双因素身份验证脚本。它现在运行得非常好,我想创建一个gui,因为它将在raspberry pi上几乎全天候运行。你知道吗

我不明白医生说的“拉伸”是什么意思。传递一个描述行/列是否应该拉伸的字符串,以填充整个GUI。“你知道吗

#!/usr/bin/env python
import pyotp
import os
import sys
import math
import time
from appJar import gui
udstart = 1
app = gui("2FA Keys","480x320")
def count(n):
        while n >= 0:
                time.sleep(1)
                n -= 1
        if n == 0:
                return 1

#Keygenertor function pass the base32 code
def keyGen(secret):
        secretcalc = pyotp.TOTP(secret)
        code = secretcalc.now()
        Lcode = list(code)
        Lcode.insert(3, " ")
        Ocode = ''.join(Lcode)
        return Ocode

#INIT CODES GO HERE
CoinbaseCode = keyGen("3JCAJVDGIW4KHUHL")
SiaCoinCode = keyGen("PFFO3KKKRQL6ACU5")

app.stretch(columns)
app.setFont(50)
app.addLabel("l2", "Sia Coin: " + SiaCoinCode, 0,0,0,0)
app.setLabelbg("l2", "blue")
app.addLabel("l1", "Coinbase: " + CoinbaseCode, 1,0,0,0) #Coinbase 2FA
app.setLabelBg("l1", "red")



while True:
        if udstart == 1:
                break
        else:
                time.sleep(30)
        break
def update():
        #UPDATE CODES GO HERE
        CoinbaseCode = keyGen("3JCAJVDGIW4KHUHL") #Coinbase
        SiaCoinCode = keyGen("PFFO3KKKRQL6ACU5")
        app.setLabel("l2", "Sia Coin: " + SiaCoinCode)
        app.setLabelBg("l2", "blue")
        app.setLabel("l1", "Coinbase: " + CoinbaseCode)
        app.setLabelBg("l1", "red")
#profit???
udstart = 0
app.registerEvent(update)
app.go()

我不知道该通过什么。你知道吗


Tags: importappl1timedefcodeguicoinbase
2条回答

如果查看appJar source code on GitHub,您可以确定应该传递给stretch的内容:

看看strech是如何使用的:

def setStretch(self, exp):
    self.setExpand(exp)
...
stretch = property(getStretch, setStretch)

查看setExpand的源代码,我们可以看到strech的可能值:

def setExpand(self, exp):
    if exp.lower() == "none":
        self.containerStack[-1]['expand'] = "NONE"
    elif exp.lower() == "row":
        self.containerStack[-1]['expand'] = "ROW"
    elif exp.lower() == "column":
        self.containerStack[-1]['expand'] = "COLUMN"
    else:
        self.containerStack[-1]['expand'] = "ALL"

因此,可能的字符串是(不区分大小写)“None”、“Row”、“Column”或其他任何字符串(这将导致“ALL”)。你知道吗

这里也有记载:http://appjar.info/pythonWidgetLayout/#set-stretch-sticky

  • 无、行、列、两者

相关问题 更多 >

    热门问题