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


Python Frame.place方法代码示例

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


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

示例1: initUI

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
 def initUI(self):
     #top frame using all the remaining space
     innerTopFrame = Frame(self, background="black")
     innerTopFrame.pack(fill=BOTH, expand=1)
     #CLOSE Label
     innerBottomLeftFrame = Frame(self, background="black")
     innerBottomLeftFrame.place(x=0, width=self.wRoot/2, 
         y=self.hRoot-200, height=200)
     closeLabel = Label(innerBottomLeftFrame, bg="black", fg="black",
         text="CLOSE", font=("Comic Sans MS", 48, "bold"))
     innerBottomLeftFrame.bind("<Enter>", lambda f: closeLabel.config(fg="white"))
     innerBottomLeftFrame.bind("<Leave>", lambda f: closeLabel.config(fg="black"))
     innerBottomLeftFrame.bind("<Button-1>", lambda f: self.root.quit())
     closeLabel.bind("<Button-1>", lambda f: self.root.quit())
     closeLabel.pack(fill=BOTH)
     #SHUT DOWN Label
     innerBottomRightFrame = Frame(self, background="black")
     innerBottomRightFrame.place(x=self.wRoot/2, width=self.wRoot/2, 
         y=self.hRoot-200, height=200)
     shutdownLabel = Label(innerBottomRightFrame, bg="black", fg="black",
         text="SHUT DOWN", font=("Comic Sans MS", 48, "bold"))
     innerBottomRightFrame.bind("<Enter>", lambda f: shutdownLabel.config(fg="white"))
     innerBottomRightFrame.bind("<Leave>", lambda f: shutdownLabel.config(fg="black"))
     innerBottomRightFrame.bind("<Button-1>", self.shutdown)
     shutdownLabel.bind("<Button-1>", self.shutdown)
     shutdownLabel.pack(fill=BOTH)
     #design the FullScreenApp
     self.pack(fill=BOTH, expand=1)
开发者ID:ilmeo,项目名称:python-homeTheater,代码行数:30,代码来源:homeTheater.py

示例2: LoginGui

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
class LoginGui(object):
    def __init__(self, root):
        self.welcome_text = 'Prihlaseny' if User.is_loaded_session() else ""

        self.response_text = StringVar(root, value=self.welcome_text)

        self.top_frame = Frame(root, width=400, height=400)

        self.middle_frame = Frame(root, width=300, height=300)

        self.top_frame.pack(fill="both", expand=True, padx=20, pady=20)
        self.middle_frame.place(in_=self.top_frame, anchor='c', relx=.5, rely=.5)

        self.l_email = Label(self.middle_frame, text="Email")
        self.e_email = Entry(self.middle_frame)

        self.l_pass = Label(self.middle_frame, text="Password")
        self.e_pass = Entry(self.middle_frame, show="*")

        self.l_sign_up = Label(self.middle_frame, text="Sign up", fg='blue', cursor='hand2')

        self.l_req_result = Label(self.middle_frame, textvariable=self.response_text)

        self.b_submit = Button(self.middle_frame, text="Login")

        self.l_email.grid(row=0, sticky=E)
        self.e_email.grid(row=0, column=1)
        self.l_pass.grid(row=1, column=0, sticky=E)
        self.e_pass.grid(row=1, column=1)
        self.b_submit.grid(row=2, column=1, sticky=E)
        self.l_sign_up.grid(row=3, column=1, sticky=E)
        self.l_req_result.grid(row=4)

        self.l_sign_up.bind('<Button-1>', self.sing_up_callback)
        self.b_submit.bind('<Button-1>', self.login)

        self.root = root
        self.root.mainloop()

    def login(self, event):
        response = User.login(self.e_email.get(), self.e_pass.get())
        self.response_text.set(response)
        if User.is_loaded_session():
            self.root.destroy()

    @staticmethod
    def sing_up_callback(event):
        webbrowser.open_new(Config.SIGN_UP_URL)

    @staticmethod
    def show_login():
        root = tkinter.Tk(className="Productivity optimizer")
        LoginGui(root)
        root.mainloop()
开发者ID:lubosch,项目名称:productivity-classifier-linux,代码行数:56,代码来源:login_gui.py

示例3: additems

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
def additems(i, doreturn=False, bgcolor="#555"):
	returnable = []
	for item in i:
		global totalitems
		totalitems += 1
		ff = Frame(f, bg=bgcolor)
		item.body = item.author.name + ' || ' + item.fullname + '\n' + item.body
		item.body = str(totalitems) + '\n' + item.body
		ibody = item.body.replace('\n\n', '\n')
		ifinal = ''
		for paragraph in ibody.split('\n'):
			ifinal += '\n'.join(textwrap.wrap(paragraph))
			ifinal += '\n'  
	
		item.body = ifinal
		ww = 680
		wh = 10 
		wx = 20
		wy = 20 
		#print(ww, wh, wx, wy)
		ff.ww = ww
		ff.wh = wh
		ff.wx = wx
		ff.wy = wy
		ff.body = item.body
		ff.sourceitem = item
		ff.configure(width=ww, height=wh)
		ff.place(x=wx, y=wy)
		ff.bind("<B1-Motion>", framedrag)
		ff.bind("<ButtonRelease-1>", resetdrag)
		ff.pack_propagate(0)
		l = Label(ff, text=item.body, bg="#777")
		l.place(x=10,y=10)
		rt = Text(ff, width= 15, height= (len(ifinal.split('\n'))) - 2)
		rt.sourceitem = item
		rt.place(x=400,y=10)
		rb = Button(ff, text="Reply", command= lambda rep=rt: reply(rep))
		rb.place(x=400,y=wh-20)
		ff.rt = rt
		ff.rb = rb
		if not doreturn:
			widgets.append(ff)
		else:
			returnable.append(ff)
	if doreturn:
		return returnable
	else:
		refreshscreen()
开发者ID:Ninjashibe,项目名称:reddit,代码行数:50,代码来源:tkdrag.py

示例4: __init__

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
class Gui:
    def __init__(self, master):
        self.arduino = None
        self.port = "COM7"
        self.updater = Thread()
        self.windowframe = Frame(master)
        self.port_entry = Entry(self.windowframe)
        self.port_label = Label(self.windowframe, text="COM Port:")
        self.arduino_connect_button = Button(self.windowframe, text="Connect Arduino", command=self.connect_arduino)
        self.start_button = Button(self.windowframe, text="Start", command=self.start)
        self.stop_Button = Button(self.windowframe, text="Exit", command=master.destroy)
        self.temperature_plot = Plot(self.windowframe, "Time [min]", "T\n\n°C", 500)
        self.place_widgets()

    def place_widgets(self):
        self.windowframe.place(x=10, y=10, width=500, height=560)
        self.port_label.place(x=0, y=0, height=25, width=160)
        self.port_entry.place(x=170, y=0, height=25, width=160)
        self.arduino_connect_button.place(x=340, y=0, width=160, height=25)
        self.start_button.place(x=0, y=30, width=245, height=25)
        self.stop_Button.place(x=255, y=30, height=25, width=245)
        self.temperature_plot.place(x=0, y=60, height=500, width=500)

    def connect_arduino(self):
        if self.port_entry.get() != "":
            self.port = self.port_entry.get()
        self.arduino = Arduino(self.port)
        sleep(1)

    def start(self):
        def update():
            start_time = datetime.now()
            while True:
                thermocouple_temperature = self.arduino.thermocouple_temperature.get()
                runtime = (datetime.now() - start_time).seconds / 60.0
                self.temperature_plot.add_datapoint(runtime, thermocouple_temperature)
        self.updater._target = update
        self.updater.start()
        self.arduino.start_updater()
开发者ID:AlexSchmid22191,项目名称:Ardutherm,代码行数:41,代码来源:GUI.py

示例5: __init__

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
class GUI:
    """For reciprocal space maps"""
    def __init__(self, master):
        self.file_path = None
        self.RSM = None

        #Defaul scale for RSM and Linescan is logarithmic
        self.rsm_scale = StringVar()
        self.rsm_scale.set("log")
        self.line_scale = StringVar()
        self.line_scale.set("log")

        #Default parameters for RSM
        self.rsm_parallel_lower = -0.01
        self.rsm_parallel_upper = 0
        self.rsm_normal_lower = 0.5
        self.rsm_normal_upper = 0.52

        #Default parameters for linescan
        self.origin_parallel = -0.0007
        self.origin_normal = 0.51192
        self.linescan_angle = 0.0
        self.linescan_width = 0.000015

        self.window_frame = Frame(master, bd=2, relief=GROOVE)
        self.fileselect_button = Button(self.window_frame, text="Select XRDML file", command=self.select_file)
        self.busy_label = Label(self.window_frame, text="")

        self.savebutton1 = Button(self.window_frame, text="Save RSM", command=lambda: self.savefigure(self.rsm_plot_figure))
        self.savebutton2 = Button(self.window_frame, text="Save Linescan", command=lambda: self.savefigure(self.linescan_plot_figure))

        self.rsm_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.rsm_label = Label(self.rsm_frame, text="Amerigo - RSM Viewer Space Map")
        self.rsm_parallel_lower_label = Label(self.rsm_frame, text="Lower q-parallel bound")
        self.rsm_parallel_lower_entry = Entry(self.rsm_frame)
        self.rsm_parallel_upper_label = Label(self.rsm_frame, text="Upper q-parallel bound")
        self.rsm_parallel_upper_entry = Entry(self.rsm_frame)
        self.rsm_normal_lower_label = Label(self.rsm_frame, text="Lower q-normal bound")
        self.rsm_normal_lower_entry = Entry(self.rsm_frame)
        self.rsm_normal_upper_label = Label(self.rsm_frame, text="Upper q-normal bound")
        self.rsm_normal_upper_entry = Entry(self.rsm_frame)
        self.rsm_sclae_linear = Radiobutton(self.rsm_frame, text="Linear", variable=self.rsm_scale, value="linear")
        self.rsm_sclae_log = Radiobutton(self.rsm_frame, text="Logarithmic", variable=self.rsm_scale, value="log")
        self.create_rsm_button = Button(self.rsm_frame, text="Create RSM", command=self.create_rsm)

        self.linescan_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.linescan_label = Label(self.linescan_frame, text="Line Scan")
        self.origin_parallel_label = Label(self.linescan_frame, text="Point of origin parallel coordinate")
        self.origin_normal_label = Label(self.linescan_frame, text="Point of origin normal coordinate")
        self.linescan_angle_label = Label(self.linescan_frame, text="Angle to parallel axis in degrees")
        self.linescan_width_label = Label(self.linescan_frame, text="Linescan thickness intervall")
        self.origin_parallel_entry = Entry(self.linescan_frame)
        self.origin_normal_entry = Entry(self.linescan_frame)
        self.linescan_angle_entry = Entry(self.linescan_frame)
        self.linescan_width_entry = Entry(self.linescan_frame)
        self.create_linescan_button = Button(self.linescan_frame, text="Create linescan", command=self.create_line_scan)
        self.line_scale_log = Radiobutton(self.linescan_frame, text="Logarithmic",
                                          variable=self.line_scale, value="log")
        self.line_scale_linear = Radiobutton(self.linescan_frame, text="Linear",
                                             variable=self.line_scale, value="linear")

        self.rsm_plot_frame = Frame(master, relief=GROOVE, bd=2)
        self.rsm_plot_figure = Figure()
        self.rsm_canvas = FigureCanvasTkAgg(self.rsm_plot_figure, master=self.rsm_plot_frame)
        self.rsm_toolbar = NavigationToolbar2TkAgg(self.rsm_canvas, self.rsm_plot_frame)
        self.rsm_toolbar.update()
        self.rsm_canvas.show()

        self.linescan_plot_frame = Frame(master, relief=GROOVE, bd=2)
        self.linescan_plot_figure = Figure()
        self.linescan_canvas = FigureCanvasTkAgg(self.linescan_plot_figure, master=self.linescan_plot_frame)
        self.linescan_toolbar = NavigationToolbar2TkAgg(self.linescan_canvas, self.linescan_plot_frame)
        self.linescan_toolbar.update()
        self.linescan_canvas.show()

        self.place_widgets()

    def place_widgets(self):
        self.window_frame.place(x=10, y=10, width=425, height=520)
        self.fileselect_button.place(x=5, y=5, width=415, height=25)
        self.savebutton1.place(x=5, y=485, height=25, width=205)
        self.savebutton2.place(x=215, y=485, height=25, width=200)

        self.rsm_frame.place(x=5, y=35, height=220, width=415)
        self.rsm_label.place(x=5, y=5, height=25, width=405)
        self.rsm_parallel_lower_label.place(x=5, y=35, height=25, width=200)
        self.rsm_normal_lower_label.place(x=5, y=65, height=25, width=200)
        self.rsm_parallel_upper_label.place(x=5, y=95, height=25, width=200)
        self.rsm_normal_upper_label.place(x=5, y=125, height=25, width=200)
        self.rsm_parallel_lower_entry.place(x=210, y=35, height=25, width=200)
        self.rsm_parallel_upper_entry.place(x=210, y=65, height=25, width=200)
        self.rsm_normal_lower_entry.place(x=210, y=95, height=25, width=200)
        self.rsm_normal_upper_entry.place(x=210, y=125, height=25, width=200)
        self.rsm_sclae_linear.place(x=5, y=155, height=25, width=200)
        self.rsm_sclae_log.place(x=210, y=155, height=25, width=200)
        self.create_rsm_button.place(x=5, y=185, height=25, width=405)

        self.linescan_frame.place(x=5, y=260, width=415, height=220)
        self.linescan_label.place(x=5, y=5, width=405, height=25)
        self.origin_parallel_label.place(x=5, y=35, width=200, height=25)
#.........这里部分代码省略.........
开发者ID:AlexSchmid22191,项目名称:Amerigo,代码行数:103,代码来源:GUI.py

示例6: __init__

# 需要导入模块: from tkinter import Frame [as 别名]
# 或者: from tkinter.Frame import place [as 别名]
class GUI:
    """A simple GUI for the PLD heater"""
    def __init__(self, master):
        self.PLD_port = "COM5"
        self.PLD_address = 5
        self.PLD = None
        self.pyrometer_port = "COM10"
        self.pyrometer = None

        self.active_plot = 1
        self.start_time = None

        self.label_updater = Thread()
        self.pyrometer_pld_communication = Thread()

        self.icon_left = PhotoImage(file="Button_left.png")
        self.icon_right = PhotoImage(file="Button_right.png")

        self.window_frame = Frame(master, bd=2, relief=GROOVE)
        self.sensor_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.parameter_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.graph_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.connect_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.log_frame = Frame(self.window_frame, bd=2, relief=GROOVE)
        self.plot_frame = Frame(self.window_frame, bd=2, relief=GROOVE)

        self.oven_temperature_label = Label(self.sensor_frame, text="Oven temperature: °C")
        self.external_temperature_label = Label(self.sensor_frame, text="Sample temperature: °C")
        self.working_setpoint_label = Label(self.sensor_frame, text="Working setpoint: °C")
        self.working_output_label = Label(self.sensor_frame, text="Working ouput %")

        self.power_output_label = Label(self.parameter_frame, text="Power output %")
        self.power_output_entry = Entry(self.parameter_frame)
        self.power_output_setter_button = Button(self.parameter_frame, text="Set power output [%]",
                                                 command=self.set_target_output_power, state=DISABLED)
        self.setpoint_label = Label(self.parameter_frame, text="Setpoint: °C")
        self.setpoint_entry = Entry(self.parameter_frame)
        self.setpoint_setter_button = Button(self.parameter_frame, text="Set target setpoint [°C]",
                                             command=self.set_target_setpoint, state=DISABLED)
        self.mode_label = Label(self.parameter_frame, text="Manual control mode")
        self.mode_switcher_button = Button(self.parameter_frame, text="Switch mode", command=self.switch_mode,
                                           state=DISABLED)
        self.external_sensor_mode_label = Label(self.parameter_frame, text="External sensor mode off")
        self.external_sensor_mode_button = Button(self.parameter_frame, text="Enable external sensor mode",
                                                  command=self.enable_external_sensor_temperature, state=DISABLED)
        self.hold_temperature_button = Button(self.parameter_frame, text="Hold temperature",
                                              command=self.hold_temperature, state=DISABLED)

        self.PLD_com_port_entry = Entry(self.connect_frame)
        self.PLD_com_port_label = Label(self.connect_frame, text="PLD COM Port")
        self.PLD_slave_address_entry = Entry(self.connect_frame)
        self.PLD_salve_address_label = Label(self.connect_frame, text="PLD slave Address (Default 1)")
        self.PLD_connect_button = Button(self.connect_frame, text="Connect PLD", command=self.connect_pld)
        self.pyrometer_com_port_entry = Entry(self.connect_frame)
        self.pyrometer_com_port_label = Label(self.connect_frame, text="Pyrometer COM Port")
        self.pyrometer_connect_button = Button(self.connect_frame, text="Connect Pyrometer",
                                               command=self.connect_pyrometer)
        self.start_label_updater_button = Button(self.connect_frame, text="Start", command=self.start_label_updater,
                                                 state=DISABLED)

        self.log_label = Label(self.log_frame, text="Temperature Log")
        self.log_text = Text(self.log_frame)

        self.switch_plot_left_button = Button(self.plot_frame, command=self.switch_plot_left, image=self.icon_left)
        self.switch_plot_right_button = Button(self.plot_frame, command=self.switch_plot_right, image=self.icon_right)
        self.plot_label = Label(self.plot_frame, text="Oven temperature")
        self.pyrometer_plot_frame = Frame(self.plot_frame)
        self.oven_temperature_plot_frame = Frame(self.plot_frame)
        self.power_ouput_plot_frame = Frame(self.plot_frame)
        self.pyrometer_plot = Plot(self.pyrometer_plot_frame, "Time [min]", "T\n\n°C", 350)
        self.power_ouput_plot = Plot(self.power_ouput_plot_frame, "Time [min]", "P\n\n%", 350)
        self.oven_temperature_plot = Plot(self.oven_temperature_plot_frame, "Time [min]", "T\n\n°C", 350)

        self.place_widgets()

    def place_widgets(self):
        """Place each widgets"""
        self.window_frame.place(x=10, y=10, height=415, width=1010)

        self.connect_frame.place(height=105, width=630, x=10, y=10)
        self.pyrometer_com_port_label.place(height=25, width=200, x=10, y=10)
        self.pyrometer_com_port_entry.place(height=25, width=200, x=215, y=10)
        self.pyrometer_connect_button.place(height=25, width=200, x=420, y=10)
        self.PLD_com_port_label.place(height=25, width=200, x=10, y=40)
        self.PLD_com_port_entry.place(height=25, width=200, x=215, y=40)
        self.PLD_connect_button.place(height=25, width=200, x=420, y=40)
        self.PLD_salve_address_label.place(height=25, width=200, x=10, y=70)
        self.PLD_slave_address_entry.place(height=25, width=200, x=215, y=70)
        self.start_label_updater_button.place(height=25, width=200, x=420, y=70)

        self.parameter_frame.place(height=135, width=630, x=10, y=125)
        self.setpoint_label.place(height=25, width=200, x=10, y=10)
        self.setpoint_entry.place(height=25, width=200, x=215, y=10)
        self.setpoint_setter_button.place(height=25, width=200, x=420, y=10)
        self.power_output_label.place(height=25, width=200, x=10, y=40)
        self.power_output_entry.place(height=25, width=200, x=215, y=40)
        self.power_output_setter_button.place(height=25, width=200, x=420, y=40)
        self.mode_switcher_button.place(height=25, width=405, x=215, y=70)
        self.mode_label.place(height=25, width=200, x=10, y=70)
        self.external_sensor_mode_label.place(height=25, width=200, x=10, y=100)
#.........这里部分代码省略.........
开发者ID:AlexSchmid22191,项目名称:Eurotherm,代码行数:103,代码来源:GUI.py


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