小编jtk*_*kiv的帖子

如何控制tkinter组合框选择突出显示

我写了一个小法拉转换器来学习GUI编程.它很棒,看起来很精致.唯一的问题是我似乎无法弄清楚如何控制我的ttk.Combobox选择中出现的这种奇怪的突出显示.我确实使用过ttk.Style(),但它只改变了ttk.Combobox背景,条目等的颜色.我也试过改变openbox/gtk主题.

法拉德

我在谈论文字"microfarads(uF)"中的内容.

如果突出显示整个盒子,那就没关系了.但我宁愿让它完全消失.

我怎样才能操纵ttk.Combobox选择的亮点?

# what the farad?
# thomas kirkpatrick (jtkiv)

from tkinter import *
from tkinter import ttk

# ze la programma.
def conversion(*args):
# this is the numerical value
inV = float(inValue.get())
# these two are the unit (farads, microfarads, etc.) values
inU = inUnitsValue.current()
outU = outUnitsValue.current()

# "mltplr" is multiplied times inValue (inV)
if inU == outU:
    mltplr = 1
else:
    mltplr = 10**((outU - …
Run Code Online (Sandbox Code Playgroud)

python combobox tkinter ttk python-3.x

9
推荐指数
2
解决办法
2万
查看次数

在python 3.1中编辑单个.txt行

我有一些数据以这种格式存储在.txt文件中:

----------|||||||||||||||||||||||||-----------|||||||||||
1029450386abcdefghijklmnopqrstuvwxy0293847719184756301943
1020414646canBeFollowedBySpaces    3292532113435532419963
Run Code Online (Sandbox Code Playgroud)

不要问......

我有很多这样的行,我需要一种方法来添加更多的数字到特定行的末尾.

我已经编写了代码来找到我想要的行,但是我很难过如何在它的末尾添加11个字符.我环顾四周,这个网站对我遇到的其他一些问题很有帮助,但我似乎无法找到我需要的东西.

重要的是,该行保留其在文件中的位置,以及其当前顺序的内容.

使用python3.1,你怎么会这样:

1020414646canBeFollowedBySpaces    3292532113435532419963
Run Code Online (Sandbox Code Playgroud)

1020414646canBeFollowedBySpaces    329253211343553241996301846372998
Run Code Online (Sandbox Code Playgroud)

python text line text-files python-3.x

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

标签 统计

python ×2

python-3.x ×2

combobox ×1

line ×1

text ×1

text-files ×1

tkinter ×1

ttk ×1