Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/328.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 如何使Tkinter Scale小部件的滑块在特定位置启动?_Python_Tkinter_Slider_Position_Tkinter Scale - Fatal编程技术网

Python 如何使Tkinter Scale小部件的滑块在特定位置启动?

Python 如何使Tkinter Scale小部件的滑块在特定位置启动?,python,tkinter,slider,position,tkinter-scale,Python,Tkinter,Slider,Position,Tkinter Scale,我正在使用tkinterScalewidget,我的刻度设置为0到200。当我打开它时,我希望滑块设置为100(槽的一半),而不是0。有没有办法做到这一点?您可以使用该方法将比例设置为任意值 下面是一个简单的脚本来演示: from tkinter import Tk, Scale root = Tk() w = Scale(root, from_=0, to=200) w.pack() w.set(100) # Set the initial value to 100 root.main

我正在使用tkinter
Scale
widget,我的刻度设置为0到200。当我打开它时,我希望滑块设置为100(槽的一半),而不是0。有没有办法做到这一点?

您可以使用该方法将比例设置为任意值

下面是一个简单的脚本来演示:

from tkinter import Tk, Scale

root = Tk()

w = Scale(root, from_=0, to=200)
w.pack()
w.set(100)  # Set the initial value to 100

root.mainloop()
例如: