小编Mat*_*990的帖子

检测数字序列中的重复循环(python)

我想知道这是一个相当"普通"或正常的做法.并不是真的在寻找像2个班轮或任何东西那样最短的答案.我只是很快将这段代码放在一起,但我不能不觉得那里有太多的东西.此外,如果有任何库可以帮助这个,这将是非常好的.

def get_cycle(line):
    nums = line.strip().split(' ')

    # 2 main loops, for x and y
    for x in range(2, len(nums)): # (starts at 2, assuming the sequence requires at least 2 members)
        for y in range(0, x):
            # if x is already in numbers before it
            if nums[x] == nums[y]:
                seq = [nums[x]] # (re)start the sequence
                adder = 1       # (re)set the adder to 1
                ok = True       # (re)set ok to be True
                # while the sequence still …
Run Code Online (Sandbox Code Playgroud)

python numbers cycle sequence

9
推荐指数
1
解决办法
7201
查看次数

如何调整 tkinter 中 simpledialog.askstring 弹出窗口的大小?

虽然使用 simplesialog.askstring 很好,但我想调整弹出窗口的大小并调整文本输入的宽度。

(示例代码)

from tkinter import *
from tkinter import simpledialog

prompts = ["name", "age", "height", "wheight"]

root = Tk()

for p in prompts:
    answer = simpledialog.askstring(p, root)
    print(answer)
Run Code Online (Sandbox Code Playgroud)

我查看了不同的文档,但似乎无法找到如何做到这一点。

python tkinter simpledialog

6
推荐指数
1
解决办法
8901
查看次数

Qt 安装程序框架:TypeError 无法读取属性名称

我尝试按照教程创建一个安装程序。然后,我根据 Qt Installer Framework 目录中的开始菜单示例添加了一个名为“installerscript.qs”的脚本。

“installscript.qs”如下:

/****************************************************************************
**
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 
**
**  open-editor to use.
**  Copyright (C) 2018  os_sys-devlopment-group
**
**  This program is free software: you can redistribute it and/or modify
**  it under the terms of the GNU General Public License as published by
**  the Free Software Foundation, either version 3 of the License, or
**  (at your option) any later version.
**  This program is distributed in the hope that it will be …
Run Code Online (Sandbox Code Playgroud)

qt qtscript qt5 qt-installer

2
推荐指数
1
解决办法
1442
查看次数

标签 统计

python ×2

cycle ×1

numbers ×1

qt ×1

qt-installer ×1

qt5 ×1

qtscript ×1

sequence ×1

simpledialog ×1

tkinter ×1