本文整理汇总了Python中tkinter.Tk.attributes方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.attributes方法的具体用法?Python Tk.attributes怎么用?Python Tk.attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.attributes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
def main() :
"""Code to read a file and assess its adherence to standards"""
global fileDict
fileDict = {}
print("\nOpening a file—look for dialog box:")
sys.stdout.flush()
win = Tk() # root window for tkinter file dialog
win.attributes('-topmost', True)
win.withdraw() # hide root window
win.lift() # move to front
filename = filedialog.askopenfilename(parent=win) # get file name
# message="Pick a Python file to check") # label on dialog box
win.destroy() # get rid of root window
print("Opening file %s, assumed to be a Python file\n" % filename)
analyzeFile(filename)
if DEBUG_LEVEL > 0 :
tokenParts = set(name for name in dir(tokenize) if name.isupper()
and type(eval("tokenize." + name))==int) # tokenize constants
tokenCodes = sorted([(eval("tokenize." + name),name) for
name in tokenParts]) # codes corresponding to tokenParts
print("\nTable of token codes")
for code, name in tokenCodes:
print("%5d %s" % (code, name))
showTermination()
return
示例2: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
def main():
window = Tk()
window.geometry('1366x768')
window.attributes('-fullscreen', True)
window.wm_title('GUIDO')
gui = GUI(window)
window.mainloop()
示例3: playScreen
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
def playScreen():
"""Draw a dark bg."""
print("*** Drawing the PlayScreen ***")
ps = Tk()
ps.title("Playing...")
ps.attributes('-fullscreen', True)
ps.configure(bg='black')
lb = Label(ps, text="Playing...", bg='black', fg='grey')
lb.pack()
ps.update_idletasks()
return(ps)
示例4: run
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
def run(*args):
# Create the GUI for the program
window = Tk()
window.wm_title("pesto_check") # change the window title to pesto_check
text = Text(window, height=3, width=65, bg="black", padx=5, pady=5,
highlightthickness=1)
text.pack()
# Tag configs for green/red font color
text.tag_config("green", foreground="green")
text.tag_config("red", foreground="red")
# Set GUI position on screen (we'll put it on the upper-right hand corner)
window.update_idletasks() # make sure that the width is up to date
width = window.winfo_screenwidth()
size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))
x = width - size[0]
window.geometry("%dx%d+%d+%d" % (size + (x, 0)))
"""Searches specified websites for pesto and outputs the results."""
# The path to the PhantomJS executable (shown below) will need to be changed on your system
# Example path: /Users/owenjow/pesto_check/phantomjs/bin/phantomjs
driver = webdriver.PhantomJS("[PATH-TO-phantomjs]") ### CHANGE THIS ###
driver.wait = WebDriverWait(driver, 5)
# Search UCB dining hall menus
search_and_output(driver, "http://goo.gl/VR8HpB", text, "DC", False)
# Search the Cheese Board weekly menu
search_cheeseboard_and_output(driver, text)
# Search the Sliver weekly menu
search_sliver_and_output(driver, text)
# Bring the Tkinter window to the front
window.lift()
window.attributes("-topmost", True)
text.configure(state="disabled") # there's no need to allow user input!
mainloop()
driver.quit()
示例5: Player
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
#.........这里部分代码省略.........
self.playUrl(self.cfg.URL5)
#---------------------------------------------------------------------#
def evtPlay(self, evt):
self.playSelection()
def evtRefresh(self, evt):
self.refreshFilesList()
def evtScan(self, evt):
self.askToRefreshDataBase()
def evtCfg(self, cfg):
self.displayConfig()
def evtHelp(self, evt):
self.displayHelp()
def evtQuit(self, evt):
self.stop()
#---------------------------------------------------------------------#
def createGui(self):
"""Create the GUI for Player"""
print("*** Creating GUI ***")
self.root.title("Raspyplayer Media Center v{}".format(VERSION))
font = Font(self.root, size=26, family='Sans')
#self.root.attributes('-fullscreen', True)
self.root.attributes('-zoomed', '1')
# Top Frame (search group)
self.ui_topframe = Frame(self.root, borderwidth=2)
self.ui_topframe.pack({"side": "top"})
# Label search
self.ui_srclabel = Label(self.ui_topframe, text="Search:",
font=font)
self.ui_srclabel.grid(row=1, column=0, padx=2, pady=2)
# Entry search
self.ui_srcentry = Entry(self.ui_topframe, font=font)
self.ui_srcentry.grid(row=1, column=1, padx=2, pady=2)
self.ui_srcentry.bind("<Return>", self.evtRefresh)
# Button search
self.ui_srcexec = Button(self.ui_topframe, text="Search",
command=self.refreshFilesList, font=font)
self.ui_srcexec.grid(row=1, column=2, padx=2, pady=2)
# Frame (contain Middle and Url frames)
self.ui_frame = Frame(self.root, borderwidth=2)
self.ui_frame.pack(fill=BOTH, expand=1)
# Middle Frame (files group)
self.ui_midframe = Frame(self.ui_frame, borderwidth=2)
self.ui_midframe.pack({"side": "left"}, fill=BOTH, expand=1)
# Files liste and scrollbar
self.ui_files = Listbox(self.ui_midframe,
selectmode=EXTENDED, font=font)
self.ui_files.pack(side=LEFT, fill=BOTH, expand=1)
self.ui_files.bind("<Return>", self.evtPlay)
self.ui_filesscroll = Scrollbar(self.ui_midframe,
command=self.ui_files.yview)
self.ui_files.configure(yscrollcommand=self.ui_filesscroll.set)
示例6: Config
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
#.........这里部分代码省略.........
else:
s = DISABLED
player.URL3L.set("N/A")
player.ui_buturl3.configure(state=s)
player.ui_buturl3.update_idletasks()
if self.URL4:
s = NORMAL
player.URL4L.set(self.URL4L)
else:
s = DISABLED
player.URL4L.set("N/A")
player.ui_buturl4.configure(state=s)
player.ui_buturl4.update_idletasks()
if self.URL5:
s = NORMAL
player.URL5L.set(self.URL5L)
else:
s = DISABLED
player.URL5L.set("N/A")
player.ui_buturl5.configure(state=s)
player.ui_buturl5.update_idletasks()
# Refresh
player.root.update_idletasks()
#---------------------------------------------------------------------#
def createGui(self):
"""Create the GUI for Config"""
print("*** Creating Configuration GUI ***")
self.root = Tk()
self.root.title("Configuration")
self.root.attributes('-topmost', True)
font = Font(self.root, size=12, family='Sans')
# Middle Frame (config group)
self.ui_midframe = Frame(self.root, borderwidth=2)
self.ui_midframe.pack(fill=BOTH, expand=1)
# PATH
self.ui_pathlbl = Label(self.ui_midframe, text="Movies root folder",
justify=LEFT, anchor=W, font=font)
self.ui_pathlbl.grid(row=0, column=0, padx=2, pady=2)
self.ui_path = Entry(self.ui_midframe, font=font)
self.ui_path.grid(row=0, column=1, padx=2, pady=2)
# EXC
self.ui_exclbl = Label(self.ui_midframe, text="Directories to exclude",
justify=LEFT, anchor=W, font=font)
self.ui_exclbl.grid(row=1, column=0, padx=2, pady=2)
self.ui_exc = Entry(self.ui_midframe, font=font)
self.ui_exc.grid(row=1, column=1, padx=2, pady=2)
# EXT
self.ui_extlbl = Label(self.ui_midframe, text="Movies extensions",
justify=LEFT, anchor=W, font=font )
self.ui_extlbl.grid(row=2, column=0, padx=2, pady=2)
self.ui_ext = Entry(self.ui_midframe, font=font)
self.ui_ext.grid(row=2, column=1, padx=2, pady=2)
# DB
self.ui_dblbl = Label(self.ui_midframe, text="Database name",
justify=LEFT, anchor=W, font=font )
self.ui_dblbl.grid(row=3, column=0, padx=2, pady=2)
self.ui_db = Entry(self.ui_midframe, font=font)
self.ui_db.grid(row=3, column=1, padx=2, pady=2)
# OUT
self.ui_outlbl = Label(self.ui_midframe, text="Audio output (local/hdmi)",
justify=LEFT, anchor=W, font=font )
self.ui_outlbl.grid(row=4, column=0, padx=2, pady=2)
示例7: Tk
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
import threading
from tkinter import Tk, Label, PhotoImage
import argparse
# Parse command-line arguments.
cli = argparse.ArgumentParser()
cli.add_argument("--window", help="Use window rather than full screen for LCD.")
args = cli.parse_args()
# Set up root viewport for tkinter graphics
root = Tk()
if args.window:
root.geometry('272x480+0+0')
root.title("piSplash")
else:
root.attributes('-fullscreen', True)
root.config(cursor="none")
root.configure(background='black')
# Preload images to make it go faster later.
imageSplash = PhotoImage(file="piDSKY2-images/splash.gif")
imageBlank = PhotoImage(file="piDSKY2-images/blank.gif")
# Initial placement of all graphical objects on LCD panel.
def displayGraphic(x, y, img):
dummy = Label(root, image=img, borderwidth=0, highlightthickness=0)
dummy.place(x=x, y=y)
displayGraphic(0, 0, imageSplash)
def blankScreen():
displayGraphic(0, 0, imageBlank)
root.update_idletasks()
root.quit()
sys.exit()
示例8: range
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import attributes [as 别名]
n[node]["tags"] = self.db.tags[node].copy()
n[node]["text"] = self.db.text[node]
n[node]["coords"] = self.db.coords[node]
n[node]["links"] = self.db.links[node].copy()
canv.insert_sticker(node, n)
for i in range(num):
noname = numerate("Node")
for sticky in canv.stickies:
for other in canv.stickies[sticky].links:
canv.stickies[sticky].connect2box(other, True)
def save_image(self):
for num, canv in enumerate(self.canvasi):
x1, y1, x2, y2 = canv.bbox("all")
canv.postscript(file="filetest{}.ps".format(num), colormode='color', x=x1-25, y=y1-25, width=x2+25, height=y2+25)
print("Writing filetest{}.ps...".format(num))
# Test function, to be removed.
def get_info(self):
for canv in self.canvasi:
ca_dict = canv.config()
print("{}{}".format(ca_dict["height"], ca_dict["width"]))
if __name__ == "__main__":
root = Tk()
root.attributes('-zoomed', True)
app = Main(root)
root.mainloop()