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


Python LabelFrame.place方法代码示例

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


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

示例1: TwitterSearcher

# 需要导入模块: from Tkinter import LabelFrame [as 别名]
# 或者: from Tkinter.LabelFrame import place [as 别名]
class TwitterSearcher(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background = "white")
        self.keyA = 1
        self.keyB = 1
        self.parent = parent
        self.initUI()
    
    def initUI(self):
        "Text to enter the clear text"
        self.clearLabelFrame = LabelFrame(self.parent, text = "Search Text")
        self.clearLabelFrame.place(x = 65, y = 20)
        self.clearText = Text(self.clearLabelFrame, width = 65, height = 5)
        self.clearText.pack()
        
        "Button to encode"
        self.encodeButton = Button(self.parent, text = "Search", command = self.search)
        self.encodeButton.place(x = 460, y = 130)
        
        "Text to display encoded text"
        self.encodedLabelFrame = LabelFrame(self.parent, text = "Tweets")
        self.encodedLabelFrame.place(x = 65, y = 160)
        self.encodedText = Text(self.encodedLabelFrame, width = 65, height = 15)
        self.encodedText.pack()
        
        "Send tweet"
        self.clearLabelFrame = LabelFrame(self.parent, text = "Tweet")
        self.clearLabelFrame.place(x = 65, y = 400)
        self.sendTweet = Text(self.clearLabelFrame, width = 65, height = 5)
        self.sendTweet.pack()
        
        "Button to encode"
        self.encodeButton = Button(self.parent, text = "Send", command = self.send)
        self.encodeButton.place(x = 470, y = 500)
        
        
    def search(self):
        clear = self.clearText.get(1.0, Tkinter.END)
        rst = Search.search(clear)
        self.encodedText.delete(1.0, Tkinter.END)
        content = Search.jsonParser(rst)
        display = ""
        
        if (len(content) == 0):
            display = "Nothing" 
        else:
            for tweet in content:
                key = tweet.keys()[0]
                display +=  key + " said: \n" + "\t" + tweet.get(key) + "\n\n"
                
            checkReport = False
            for tweet in content:
                if(Search.insertMySQL(tweet)):
                    checkReport = True
            if(checkReport):
                tkMessageBox.showinfo("Insert to database", "Insert successfully" )
        
        self.encodedText.insert(1.0, display)
        
    def send(self):
        message = self.sendTweet.get(1.0, Tkinter.END)
        #print len(message)
        if(142> len(message)>1):
            SendMessage.send(message)
            tkMessageBox.showinfo("Send", "Send successfully")
        else:
            tkMessageBox.showinfo("Send", "No tweet to send, please enter your tweet")
开发者ID:hugo53,项目名称:HUtweetutils,代码行数:69,代码来源:GUI.py


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