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


Python Label.place方法代码示例

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


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

示例1: Application

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
class Application(object):

    def __init__(self):
        self.helper = YouDaoHelper()
        self.window = Tk()
        self.window.title(u'知了词典')
        self.window.geometry("280x350+700+300")
        # 输入框
        self.entry = Entry(self.window)
        self.entry.place(x=10, y=10, width=200, height=25)

        # 提交按钮
        self.submit_btn = Button(self.window, text=u'查询', command=self.submit)
        self.submit_btn.place(x=220, y=10, width=50, height=25)

        # 翻译结果标题
        self.title_label = Label(self.window, text=u'翻译结果:')
        self.title_label.place(x=10, y=55)

        # 翻译结果
        self.result_text = Text(self.window, background='#ccc')
        self.result_text.place(x=10, y=75, width=260, height=265)

    def submit(self):
        # 1. 从输入框中获取用户输入的值
        content = self.entry.get()
        # 2. 把这个值发送给有道的服务器,进行翻译
        result = self.helper.crawl(content)
        # 3. 把结果放在底部的Text控件中
        self.result_text.delete(1.0,END)
        self.result_text.insert(END,result)

    def run(self):
        self.window.mainloop()
开发者ID:EleVenPerfect,项目名称:OTHERS,代码行数:36,代码来源:youdaofanyi.py

示例2: view_new_title

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
 def view_new_title(self, Medikom, entry_type):
     self.selected_id = False
     self.overview(Medikom)
     if entry_type == 0:
         text = "Titel der neuen Aufgabe:"
     elif entry_type == 1:
         text = "Titel der neuen Information:"
     details_label = Label(
         self, text=text, font='Liberation 10',
         fg='Black')
     details_label.place(
         x=self.SPACE_TWO / 2,
         y=(self.n + 2) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH - self.SPACE_TWO, height=self.ROW_HIGHT)
     textframe = Text(self, font='Liberation 12', height=1, width=int(self.WIN_WIDTH / 4))
     textframe.place(
         x=self.SPACE_TWO, y=(self.n + 3) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH - self.SPACE_ONE - 10, height=self.ROW_HIGHT)
     create_button = Button(
         self, text='Erstellen',
         command=lambda: self.add_entry(Medikom, entry_type, textframe.get(1.0, END).strip()))
     create_button.place(
         x=(self.WIN_WIDTH / 2) - (self.WIN_WIDTH / 16),
         y=(self.n + 4) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH / 8, height=self.ROW_HIGHT)
开发者ID:g-murzik,项目名称:medikom,代码行数:27,代码来源:medikom_front_end.py

示例3: initUI

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
    def initUI(self):
        self.parent.title("Absolute positioning")
        self.pack(fill=BOTH, expand=1)

        bard = Image.open("linux_256.jpg")
        bardejov = ImageTk.PhotoImage(bard)
        label1 = Label(self, image=bardejov)
        label1.image = bardejov
        label1.place(x=20, y=20)
开发者ID:hangyeolkim91,项目名称:python3_document,代码行数:11,代码来源:example_tk_3_frame.py

示例4: AddManually

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
class AddManually(Frame):

    def __init__(self, parent, controller):
        Frame.__init__(self, parent)
        self.controller = controller

        self.place(relx=0.0, rely=0.0, relheight=0.62, relwidth=0.72)
        self.configure(relief=GROOVE)
        self.configure(borderwidth="2")
        self.configure(relief=GROOVE)
        self.configure(width=125)

        self.label_top = Label(self)
        self.label_top.place(relx=0.4, rely=0.03, height=21, width=112)
        self.label_top.configure(text="Add items manually")

        self.name = Entry(self, fg='grey')
        self.name.place(relx=0.05, rely=0.31, relheight=0.08, relwidth=0.29)
        self.name.insert(0, "Input name here")
        self.name.bind('<Button-1>', lambda event: greytext(self.name))

        self.link = Entry(self, fg='grey')
        self.link.place(relx=0.65, rely=0.31, relheight=0.08, relwidth=0.29)
        self.link.insert(0, "Input link here")
        self.link.bind('<Button-1>', lambda event: greytext(self.link))

        self.add_btn = Button(self, command=self.send_data)
        self.add_btn.place(relx=0.42, rely=0.44, height=34, width=100)
        self.add_btn.configure(text="Add item")

        self.back = Button(self, command=lambda: controller.show_frame('Main'))
        self.back.place(relx=0.42, rely=0.64, height=34, width=100)
        self.back.configure(text="Go back")

        name_label = Label(self)
        name_label.place(relx=0.05, rely=0.22, height=21, width=38)
        name_label.configure(text="Name")

        link_label = Label(self)
        link_label.place(relx=0.65, rely=0.22, height=21, width=28)
        link_label.configure(text="Link")

    def send_data(self):
        if self.link.cget('fg') == 'grey' or self.name.cget('fg') == 'grey':
            return
        link = self.link.get()
        if link.strip() != '':
            name = self.name.get()
            self.controller.add_item(link, name)
            print("Item added")
开发者ID:s0hvaperuna,项目名称:Custom-playlist,代码行数:52,代码来源:addlink.py

示例5: additems

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label 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

示例6: __init__

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
    def __init__(self, master):
        self.master = master
        self.master.title("Log In Screen")
        usernamelabel = Label(master,text="User name:")
        usernamelabel.place(x=10,y=20)
        passwordlabel = Label(master,text="Password:")
        passwordlabel.place(x=10,y=40)
        '''Create List Of User Names '''
        usernames = []
        with open('../CSV/Username_Passwords.csv', 'r') as f:
            u_p_file = csv.reader(f)
            for row in u_p_file:
                u_name = row[0]
                usernames.append(u_name)

        usernameentry = ttk.Combobox(master)
        usernameentry['values'] = usernames
        usernameentry.place(x=80,y=20)
开发者ID:Jcarey95,项目名称:Stock_EPOS,代码行数:20,代码来源:TestGUI.py

示例7: _init_ui

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
 def _init_ui(self):
     # Label to specify video link
     lbl_video_url = Label(self, text="Video URL:")
     lbl_video_url.place(x=20, y=20)
     # Entry to enter video url
     entr_video_url = Entry(self, width=50, textvariable=self._video_url)
     entr_video_url.place(x=100, y=20)
     # Checkbutton to extract audio
     cb_extract_audio = Checkbutton(self, var=self._extract_audio, text="Only keep audio")
     cb_extract_audio.pack()
     cb_extract_audio.place(x=20, y=60)
     # Button to browse for location
     b_folder_choose = Button(self, text="Choose output directory", command=self.ask_directory)
     b_folder_choose.place(x=150, y=90)
     # Button to start downloading
     b_start_download = Button(self, text="Start download", command=self.download)
     b_start_download.place(x=20, y=90)
     # Log window to log progress
     self._logger.place(x=20, y=130)
开发者ID:pielambr,项目名称:ydlui,代码行数:21,代码来源:main.py

示例8: view_edit_title

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
 def view_edit_title(self, Medikom, id, old_title, *__):
     self.overview(Medikom)
     text = "Neuer Titel des Eintrags:"
     details_label = Label(
         self, text=text, font='Liberation 10',
         fg='Black')
     details_label.place(
         x=self.SPACE_TWO / 2,
         y=(self.n + 2) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH - self.SPACE_TWO, height=self.ROW_HIGHT)
     textframe = Text(self, font='Liberation 12', height=1, width=int(self.WIN_WIDTH / 4))
     textframe.place(
         x=self.SPACE_TWO, y=(self.n + 3) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH - self.SPACE_ONE - 10, height=self.ROW_HIGHT)
     textframe.insert(END, old_title)
     create_button = Button(
         self, text='Aktualisieren',
         command=lambda: self.update_entry_title(Medikom, id, textframe.get(1.0, END).strip()))
     create_button.place(
         x=(self.WIN_WIDTH / 2) - (self.WIN_WIDTH / 16),
         y=(self.n + 4) * (self.ROW_HIGHT + self.ROW_SPACE),
         width=self.WIN_WIDTH / 8, height=self.ROW_HIGHT)
开发者ID:g-murzik,项目名称:medikom,代码行数:24,代码来源:medikom_front_end.py

示例9: __init__

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label 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

示例10: initUI

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
 def initUI(self):
   
     self.parent.title("My Tool Client")
     self.pack(fill=BOTH, expand=1)
     quitButton = Button(self, text="Exit",
         command=self.quit, padx=50, pady=30)
     quitButton.place(x=674, y=0)
     myToolLabel = Label(self, text="Welcome to MyTool!", font=("Helvetica",16), padx=50)
     employeeName = Label(self, text="Julio", font=("Helvetica",10), padx=50)
     myToolLabel.place(x=0, y=0)
     employeeName.place(x=0, y=30)
     dateAndTime = Label(self, text=time.asctime())
     dateAndTime.place(x=0, y=50)
开发者ID:jdpeterman,项目名称:SoftwareEngineering,代码行数:15,代码来源:myTool.py

示例11: overview

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
    def overview(self, Medikom):
        # get content
        tasks_results, information_results = Medikom.get_titles()

        # clear screen
        canvas = Canvas(self, width=self.WIN_WIDTH, height=self.WIN_HIGHT * 2)
        canvas.place(x=0, y=0)

        # headers
        tasks_label = Label(self, text='Aufgaben', font='Liberation 14')
        tasks_label.place(
            x=0, y=0, width=self.WIN_WIDTH/2, height=self.ROW_HIGHT)
        info_label = Label(self, text='Informationen', font='Liberation 14')
        info_label.place(
            x=self.WIN_WIDTH/2, y=0,
            width=self.WIN_WIDTH/2, height=self.ROW_HIGHT)

        self.list_entries(Medikom, tasks_results, 0)
        self.list_entries(Medikom, information_results, 1)

        # lower window part
        canvas.create_line(
            self.SPACE_ONE, (self.n + 1.5) * (self.ROW_HIGHT + self.ROW_SPACE),
            self.WIN_WIDTH - self.SPACE_ONE, (self.n + 1.5) * (self.ROW_HIGHT + self.ROW_SPACE),
            fill='#000001', width=1)

        add_task_button = Button(self, text='+',
            command=Callable(self.view_new_title, Medikom, 0))
        add_task_button.place(
            x=self.WIN_WIDTH / 4 - self.SPACE_TWO / 2,
            y=self.n * (self.ROW_HIGHT + self.ROW_SPACE),
            width=self.SPACE_TWO, height=self.ROW_HIGHT)

        add_info_button = Button(self, text='+',
            command=Callable(self.view_new_title, Medikom, 1))
        add_info_button.place(
            x=0.75 * self.WIN_WIDTH - self.SPACE_TWO / 2,
            y=self.n * (self.ROW_HIGHT + self.ROW_SPACE),
            width=self.SPACE_TWO, height=self.ROW_HIGHT)

        if self.selected_id is None:
            selection_label = Label(
                self, text='Kein Eintrag ausgewählt.', font='Liberation 10')
            selection_label.place(
                x=self.WIN_WIDTH / 2 - 0.125 * self.WIN_WIDTH,
                y=(self.n + 1) * (self.ROW_HIGHT + self.ROW_SPACE),
                width=self.WIN_WIDTH / 4, height=self.ROW_HIGHT)
开发者ID:g-murzik,项目名称:medikom,代码行数:49,代码来源:medikom_front_end.py

示例12: MainForm

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
class MainForm(Tk, Observer):
    """ Defines a form object based from Tk in tkinter. """

    def __init__(self):
        """ Initializes the control object and controls of the form. """
        Tk.__init__(self)
        Observer.__init__(self)
        self.ctrl_anon = None
        self.resizable(0, 0)
        self._reset_controls()

        # Center window
        width = 800
        height = 500
        scr_width = self.winfo_screenwidth()
        scr_height = self.winfo_screenheight()

        # Calculate dimensions
        x = (scr_width/2) - (width/2)
        y = (scr_height/2) - (height/2)

        # Set window dimensions
        geo = str(width) + "x" + str(height) + "+" + str(x)[:-2] + "+" + str(y)[:-2]
        self.geometry(geo)
    
    def _reset_controls(self):
        """ Resets the controls on the form. """
        image = ImageTk.PhotoImage(file="bg.png")
        
        # Initialize controls
        self.lbl_bg = Label(self, image=image)
        self.lbl_dir = Label(self, bg="white", fg="#668FA7", font=("Courier", 14))
        self.lbl_anon = Label(self, bg="white", fg="#668FA7", font=("Courier", 14))
        self.lbl_id = Label(self, bg="white", fg="#668FA7", font=("Courier", 14))
        self.btn_dir_select = Button(self, text="Select data folder", command=self._btn_dir_press)
        self.btn_id = Button(self, text="Identify data", command=self._btn_id_press)
        self.btn_anon = Button(self, text="Anonymize data", command=self._btn_anon_press)
        self.tb_study = Entry(self, bg="#668FA7", fg="white")
        self.prg_id = Progressbar(self, orient="horizontal", length=200, mode="determinate")
        self.prg_anon = Progressbar(self, orient="horizontal", length=200, mode="determinate")

        # Place controls
        self.lbl_bg.place(x=0, y=0, relwidth=1, relheight=1)
        self.lbl_anon.place(x=400, y=400)
        self.lbl_id.place(x=400, y=325)
        self.btn_dir_select.place(x=250, y=250)
        self.btn_id.place(x=250, y=325)
        self.btn_anon.place(x=250, y=400)
        self.tb_study.place(x=250, y=175)
        self.prg_id.place(x=410, y=290)
        self.prg_anon.place(x=410, y=370)

        # Other formatting
        self.lbl_bg.image = image
        self.btn_id['state'] = "disabled"
        self.btn_anon['state'] = "disabled"
        self.prg_id['maximum'] = 100
        self.prg_anon['maximum'] = 100

    def _btn_dir_press(self):
        """ Allows user to select their data folder. """
        self.ctrl_anon.reset()
        dir = filedialog.askdirectory(initialdir='.')
        if len(dir) > 0:
            self.lbl_dir.config(text=dir)
            self.btn_id['state'] = "active"
            self.btn_anon['state'] = "disabled"
        else:
            self.btn_id['state'] = "disabled"
            self.btn_anon['state'] = "disabled"
    
    def _btn_id_press(self):
        """ Calls the controller to identify data set. """
        self.ctrl_anon.identify(self.lbl_dir['text'])
        self.btn_anon['state'] = "active"
    
    def _btn_anon_press(self):
        """ Calls the controller to anonymize the data set. """
        if len(self.tb_study.get()) == 0:
            self.lbl_anon.config(text="Please enter a study name..")
        elif not self.tb_study.get().isalnum():
            self.lbl_anon.config(text="Please enter a valid study name..")
        else:
            self.ctrl_anon.anonymize(self.tb_study.get(), self.lbl_dir['text'])
    
    def notify(self):
        """ Updates the progress of the anonymization and identification processes. """
        self.prg_id['value'] = self.ctrl_anon.id_progress
        if self.prg_id['value'] == 100:
            self.lbl_id.config(text="Identification compelete")
        elif self.prg_id['value'] > 0:
            self.lbl_id.config(text="Identification in progress..")
        
        self.prg_anon['value'] = self.ctrl_anon.anon_progress
        if self.prg_anon['value'] == 100:
            self.lbl_anon.config(text="Anonymization compelete")
        elif self.prg_anon['value'] > 0:
            self.lbl_anon.config(text="Anonymization in progress..")
        
    def add_controller(self, control_anon):
#.........这里部分代码省略.........
开发者ID:Sciprios,项目名称:Anonymizer,代码行数:103,代码来源:views.py

示例13: __init__

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
class App:
    """GUI for controlling the laser"""
    def __init__(self, master):
        self.frame = Frame(master, width=835, height=195)
        self.frame.pack()
        master.wm_title("Pulsar Laser Control")
        self.portLabel = Label(text="COM Port:")
        self.portLabel.place(x=10, y=10, width=200, height=25)
        self.portEntry = Entry(self.frame)
        self.portEntry.place(x=215, y=10, width=200, height=25)
        self.connectButton = Button(text="Connect Arduino", command=lambda: connectserial(self.portEntry.get()))
        self.connectButton.place(x=420, y=10, width=200, height=25)
        self.connectLabel = Label(text="Arduino not connected")
        self.connectLabel.place(x=625, y=10, width=200, height=25)
        self.label1 = Label(self.frame, text="Number of pulses:")
        self.label1.place(x=10, y=40, height=25, width=200)
        self.entryPulse = Entry(self.frame)
        self.entryPulse.place(x=215, y=70, height=25, width=200)
        self.label2 = Label(self.frame, text="Pulse frequency: ")
        self.label2.place(x=10, y=70, height=25, width=200)
        self.entryFreq = Entry(self.frame)
        self.entryFreq.place(x=215, y=40, height=25, width=200)
        self.startButton = Button(text="Start Laser",
                                  command=lambda: setlaseron(self.entryFreq.get(), self.entryPulse.get()))
        self.startButton.place(x=420, y=40, height=25, width=200)
        self.stopButton = Button(text="Stop Laser", command=setlaseroff)
        self.stopButton.place(x=625, y=40, height=25, width=200)
        self.pauseButton = Button(text="Pause Laser", command=setlaserpaused)
        self.pauseButton.place(x=420, y=70, height=25, width=200)
        self.contButton = Button(text="Continue Laser", command=setlasercontinue)
        self.contButton.place(x=625, y=70, height=25, width=200)
        self.statusLabel = Label(text="")
        self.statusLabel.place(x=10, y=100, height=25, width=405)
        self.pulseLabel = Label(text="")
        self.pulseLabel.place(x=420, y=100, height=25, width=405)
        self.startTimeLabel = Label(text="")
        self.startTimeLabel.place(x=10, y=130, height=25, width=200)
        self.stopTimeLabel = Label(text="")
        self.stopTimeLabel.place(x=215, y=130, height=25, width=200)
        self.etaLabel = Label(text="")
        self.etaLabel.place(x=420, y=130, height=25, width=405)
        self.exitButton = Button(text="Exit", command=root.destroy)
        self.exitButton.place(x=410, y=160, height=25, width=405)
        self.advancedButton = Button(text="Enable advanced mode", command=enableadvanced)
        self.advancedButton.place(x=10, y=160, height=25, width=200)
        self.simpleButton = Button(text="Disbale advanced mode", command=disableadvanced)
        self.simpleButton.place(x=215, y=160, height=25, width=200)
开发者ID:AlexSchmid22191,项目名称:Pulsar,代码行数:49,代码来源:Pulsar.py

示例14: Tabblet

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
class Tabblet():
	def __init__(self):
		self.tkvar = tkinter.Tk()

		with open("options.json") as j:
			joptions = json.load(j)

		self.tkvar.wm_title("Tabblet")
		self.tkvar.iconbitmap('resources\\tabbleto.ico')

		self.screenwidth = self.tkvar.winfo_screenwidth()
		self.screenheight = self.tkvar.winfo_screenheight()
		self.windowwidth = int(joptions['width'])
		self.windowheight = int(joptions['height'])
		self.windowx = (self.screenwidth-self.windowwidth) / 2
		self.windowy = ((self.screenheight-self.windowheight) / 2) - 27
		self.geometrystring = '%dx%d+%d+%d' % (self.windowwidth, self.windowheight, self.windowx, self.windowy)
		self.tkvar.geometry(self.geometrystring)

		self.image_resetwindow = PhotoImage(file="resources\\resetwindow.gif")
		self.button_resetwindow = Button(self.tkvar, command= lambda: self.tkvar.geometry(self.geometrystring))
		self.button_resetwindow.configure(relief="flat", image=self.image_resetwindow)
		self.button_resetwindow.pack(expand=False,anchor="ne")

		self.tkvar.bind('<Configure>', lambda event: self.button_resetwindow.place(x=self.tkvar.winfo_width()-20, y=0))
		self.tkvar.bind('<B1-Motion>', self.dragmotion)
		self.tkvar.bind('<ButtonPress-1>', lambda event: self.mousestate(True))
		self.tkvar.bind('<ButtonRelease-1>', lambda event: self.mousestate(False))
		
		self.velocityx = 0
		self.velocityy = 0
		self.mousepositionsx = [2]
		self.mousepositionsy = [2]
		self.ismousepressed = False
		self.labelvelocityind = Label(self.tkvar, text='•')
		velocitythread = threading.Thread(target=self.velocitymanager)
		velocitythread.daemon = True
		velocitythread.start()
		self.tkvar.mainloop()

	def dragmotion(self, event):
		#print(event.x, event.y)
		self.mousepositionsx.append(event.x)
		self.mousepositionsy.append(event.y)
		self.mousepositionsx = self.mousepositionsx[-20:]
		self.mousepositionsy = self.mousepositionsy[-20:]
		print(event.x, event.y)

	def mousestate(self, state):
		self.ismousepressed = state

	def velocitymanager(self):
		while True:
			if not self.ismousepressed:
				try:
					self.velocityx = (sum(self.mousepositionsx)/len(self.mousepositionsx)) - self.mousepositionsx[-1]
					self.velocityy = (sum(self.mousepositionsy)/len(self.mousepositionsy)) - self.mousepositionsy[-1]
				except:
					self.velocityx = 0
					self.velocityy = 0
				self.velocityx = int(self.velocityx * 0.9)
				self.velocityy = int(self.velocityy * 0.9)
			#print(self.velocityx, self.velocityy, self.ismousepressed)
			if abs(self.velocityx) < 2:
				self.velocityx = 0
			if abs(self.velocityy) < 2:
				self.velocityy = 0
			time.sleep(0.0165)
			#60 fps baby
			self.labelvelocityind.configure(text="•")
			self.labelvelocityind.place(x=512+self.velocityx, y=288+self.velocityy)
			self.mousepositionsx = self.mousepositionsx[1:]
			self.mousepositionsy = self.mousepositionsy[1:]
开发者ID:ChangedNameTo,项目名称:redditbots,代码行数:75,代码来源:tabblet.py

示例15: displayGraphic

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import place [as 别名]
def displayGraphic(x, y, img):
	dummy = Label(root, image=img, borderwidth=0, highlightthickness=0)
	dummy.place(x=x, y=y)
开发者ID:rburkey2005,项目名称:virtualagc,代码行数:5,代码来源:piSplash.py


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