当前位置: 首页>>代码示例>>Python>>正文


Python Combobox.place方法代码示例

本文整理汇总了Python中tkinter.ttk.Combobox.place方法的典型用法代码示例。如果您正苦于以下问题:Python Combobox.place方法的具体用法?Python Combobox.place怎么用?Python Combobox.place使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.ttk.Combobox的用法示例。


在下文中一共展示了Combobox.place方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GUI

# 需要导入模块: from tkinter.ttk import Combobox [as 别名]
# 或者: from tkinter.ttk.Combobox import place [as 别名]
class GUI(tkinter.Tk):
    def __init__(self,):
        tkinter.Tk.__init__(self)
        self.title('Van der Pol Generator Visualizer v1.0')
        self.geometry('800x450')

        self.colors = self.get_colors()

        self.parameters_label = tkinter.Label(self, text='Parameters', font=("Arial", 16))
        self.parameters_label.place(x=20, y=17)

        self.l_parameter_label = tkinter.Label(self, text='l  = ', font=('Times New Roman', 13, 'italic'))
        self.l_parameter_label.place(x=20, y=60)

        self.l_parameter_entry = tkinter.Entry(self)
        self.l_parameter_entry.config(width=8)
        self.l_parameter_entry.place(x=60, y=63)

        self.m_parameter_label = tkinter.Label(self, text='m = ', font=('Times New Roman', 13, 'italic'))
        self.m_parameter_label.place(x=20, y=90)

        self.m_parameter_entry = tkinter.Entry(self)
        self.m_parameter_entry.config(width=8)
        self.m_parameter_entry.place(x=60, y=93)

        self.start_x_label = tkinter.Label(self, text='Start X = ', font=('Arial', 11))
        self.start_x_label.place(x=20, y=160)

        self.start_x_entry = tkinter.Entry(self)
        self.start_x_entry.config(width=8)
        self.start_x_entry.insert(0, '0.0')
        self.start_x_entry.place(x=90, y=163)

        self.start_y_label = tkinter.Label(self, text='Start Y = ', font=('Arial', 11))
        self.start_y_label.place(x=20, y=180)

        self.start_y_entry = tkinter.Entry(self)
        self.start_y_entry.config(width=8)
        self.start_y_entry.insert(0, '0.1')
        self.start_y_entry.place(x=90, y=183)

        self.h_label = tkinter.Label(self, text='h = ', font=('Arial', 11))
        self.h_label.place(x=180, y=160)

        self.steps_label = tkinter.Label(self, text='Steps = ', font=('Arial', 11))
        self.steps_label.place(x=180, y=180)

        self.h_entry = tkinter.Entry(self)
        self.h_entry.config(width=8)
        self.h_entry.insert(0, '0.01')
        self.h_entry.place(x=210, y=163)

        self.steps_entry = tkinter.Entry(self)
        self.steps_entry.config(width=8)
        self.steps_entry.insert(0, '10000')
        self.steps_entry.place(x=240, y=183)

        self.color_label = tkinter.Label(self, text='Color', font=('Arial', 11))
        self.color_label.place(x=20, y=240)

        self.color_box = Combobox(self, values=self.colors)
        self.color_box.set('Black')
        self.color_box.place(x=20, y=265)

        self.add_button = tkinter.Button(self, text='Add', font=('Arial', 13), width=10, command=self.add_graphic)
        self.add_button.place(x=220, y=260)

        self.show_button = tkinter.Button(self, text='SHOW', font=('Arial', 14), width=15, height=2, command=self.show)
        self.show_button.place(x=300, y=350)

        self.plot = Plot()

        self.info_labels = tkinter.Listbox(self, selectmode='MULTIPLE', width=60, height=17)
        self.info_labels.bind('<<ListboxSelect>>', self.on_select)
        self.info_labels.place(x=420, y=20)

    def on_select(self, event):
        selected = event.widget.curselection()
        if not selected:
            return
        num = selected[0]
        self.plot.remove(0)
        self.info_labels.delete(num)

    def show(self):
        self.plot.draw()

    def get_values(self):
        try:
            l_parameter = float(self.l_parameter_entry.get())
        except ValueError:
            self.show_error('l parameter is invalid')
            return
        try:
            m_parameter = float(self.m_parameter_entry.get())
        except ValueError:
            self.show_error('m parameter is invalid')
            return
        start_x = float(self.start_x_entry.get())
        start_y = float(self.start_y_entry.get())
#.........这里部分代码省略.........
开发者ID:trtz,项目名称:van_der_pol,代码行数:103,代码来源:main.py


注:本文中的tkinter.ttk.Combobox.place方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。