Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-使用tks.color\u tints\u和\u shades_Python_Tkinter - Fatal编程技术网

Python-使用tks.color\u tints\u和\u shades

Python-使用tks.color\u tints\u和\u shades,python,tkinter,Python,Tkinter,我是Python新手,希望使用tkStuff包生成色彩。有关资料可在此查阅: 我已成功安装并导入了ColorTint(从tks.color\u tints\u和\u shades导入ColorTint),但我无法使其正常工作 作为一个新手,我正在努力获得一个工作脚本。理想情况下,我希望用户输入RGB值并返回结果色调。另一种方法(可能更复杂)是读取一个RGB值文件,然后写入一个原始颜色文件,然后是色调 非常感谢大家的帮助 谢谢, A 编辑: 我已经试过了- try: import tkin

我是Python新手,希望使用tkStuff包生成色彩。有关资料可在此查阅:

我已成功安装并导入了ColorTint(从tks.color\u tints\u和\u shades导入ColorTint),但我无法使其正常工作

作为一个新手,我正在努力获得一个工作脚本。理想情况下,我希望用户输入RGB值并返回结果色调。另一种方法(可能更复杂)是读取一个RGB值文件,然后写入一个原始颜色文件,然后是色调

非常感谢大家的帮助

谢谢, A

编辑:

我已经试过了-

try:
    import tkinter as tk
except ImportError:
    import Tkinter as tk

from tks.color_tints_and_shades import ColorTint
from tks.color_var import ColorVar

colour = (100,150, 200)

if __name__ == '__main__':
    root = tk.Tk()
    root.title('Colour Tint')
    entry = ColorTint(root, colour, count=5, percent=(1,5) )
    entry.grid(row=0, column=0, sticky=tk.EW)
    root.columnconfigure(0, weight=1)
    root.mainloop()

我最初使用硬编码的RGB值启动(或尝试启动)。

您已将变量
color
设置为元组:

colour = (100, 150, 200)

但是根据,由于您将它作为第二个参数传递给
ColorTint
,因此它的类型应该是
tks.color\u var.ColorVar

Cool。它工作吗?如果不工作,错误消息是什么,或者它做错了什么?它不工作。我得到了以下错误:回溯(最近一次调用上次):文件“C:\Users\Alan\Dropbox\Python\tks\u ColorTint.py”,第14行,在entry=ColorTint(root,color,count=5,percent=(1,5))文件“C:\Program Files\Python27\lib\site packages\tks\color\u tints\u and\u shades.py”,第139行,在init func=rgb\u tints)文件中“C:\Program Files\Python27\lib\site packages\tks\color\u tints\u and\u shades.py”,第52行,在init self.color\u var.trace\u variable('w',self.\u color\u var\u changed)AttributeError:'tuple'对象没有属性'trace\u variable'。这是有问题的行:entry=ColorTint(root,color,count=5,percent=(1,5))。我遗漏了什么?