本文整理汇总了Python中tkinter.Tk.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.configure方法的具体用法?Python Tk.configure怎么用?Python Tk.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.configure方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def main():
'''runs the program'''
square_width = 64
num_cols = 7
num_rows = 6
canvas_width = (num_cols+1)*square_width
canvas_height = (num_rows+1)*square_width
window = Tk()
window.configure(background='black')
window.title("DynaBLASTER")
window.resizable(0,0) #removes maximize option
#window.iconbitmap('icon.ico')
#window.tk.call('tk', 'scaling', 20.0)
canvas = Canvas(window, width=canvas_width, highlightthickness=0,
height=canvas_height, background='#717171')
canvas.grid(row=1,column=0, columnspan=5)
graphics = Graphics(canvas, num_rows, num_cols, square_width, window)
board = Board(canvas, square_width, num_rows, num_cols,
canvas_width, canvas_height)
col=0
row=0
player1 = Player(canvas, board, square_width, graphics, col, row)
col = graphics.cols - 3
row = graphics.rows - 3
player2 = Player(canvas, board, square_width, graphics, col, row)
# Import settings from bindings file
bindings_file = open('bindings.json')
p1_bindings, p2_bindings, gen_bindings = json.load(bindings_file)
window.bind(key_release_of(p1_bindings["Up"]), lambda event:player1.key_release('Up'))
window.bind(key_release_of(p1_bindings["Down"]), lambda event:player1.key_release('Down'))
window.bind(key_release_of(p1_bindings["Left"]), lambda event:player1.key_release('Left'))
window.bind(key_release_of(p1_bindings["Right"]), lambda event:player1.key_release('Right'))
window.bind(p1_bindings["Up"], lambda event:player1.key_press('Up'))
window.bind(p1_bindings["Down"],lambda event:player1.key_press('Down'))
window.bind(p1_bindings["Left"], lambda event:player1.key_press('Left'))
window.bind(p1_bindings["Right"], lambda event:player1.key_press('Right'))
window.bind(p1_bindings["Bomb"], player1.place_bomb)
window.bind(key_release_of(p2_bindings["Up"]), lambda event:player2.key_release('Up'))
window.bind(key_release_of(p2_bindings["Down"]), lambda event:player2.key_release('Down'))
window.bind(key_release_of(p2_bindings["Left"]), lambda event:player2.key_release('Left'))
window.bind(key_release_of(p2_bindings["Right"]), lambda event:player2.key_release('Right'))
window.bind(p2_bindings["Up"], lambda event:player2.key_press('Up'))
window.bind(p2_bindings["Down"], lambda event:player2.key_press('Down'))
window.bind(p2_bindings["Left"], lambda event:player2.key_press('Left'))
window.bind(p2_bindings["Right"], lambda event:player2.key_press('Right'))
window.bind(p2_bindings["Bomb"], player2.place_bomb)
window.bind(gen_bindings["Pause"], lambda event:pause_game(player1, player2, graphics))
window.mainloop()
示例2: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def main():
rootWindow = Tk()
rootWindow.title("Congratulations!")
rootWindow.minsize(width=200, height=200)
rootWindow.configure(background='blue')
app = Frame1(rootWindow)
app.mainloop()
示例3: _test
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def _test():
import sys
from tkinter import Tk
root = Tk()
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例4: playScreen
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [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)
示例5: _object_browser
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def _object_browser(parent):
import sys
from tkinter import Tk
root = Tk()
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 100))
root.configure(bd=0, bg="yellow")
root.focus_set()
sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1)
sc.frame.pack(expand=1, fill="both")
item = make_objecttreeitem("sys", sys)
node = TreeNode(sc.canvas, None, item)
node.update()
root.mainloop()
示例6: popupmsg
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def popupmsg(msg):
popup = Tk()
popup.wm_title("Alarm Condition")
popup.configure(background='#FFE6E6')
label = Label(popup, text=msg, font=NORM_FONT, fg = '#460303', bg='#FFE6E6')
label.pack(side="top", fill="x", pady=10)
B1 = Button(popup, text="Dismiss", bg='red',command=popup.destroy)
B1.pack()
if messagebox.askyesno("Acknowledge Alarm?",msg):
plcWrite3.write_xv()
Logger.Logit("ACK",msg)
popup.destroy
else :
Logger.Logit("Not ACK",msg)
popup.mainloop()
示例7: create_toolbar
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def create_toolbar(self):
self.toolbar = Frame(self.parent)
self.btn_new = Button(self.toolbar, text='New', command=self.new_file)
self.btn_new.grid(row=0, column=0)
self.btn_open = Button(self.toolbar, text='Open', command=self.open_file)
self.btn_open.grid(row=0, column=1)
self.toolbar.pack(fill='both')
def open_file(self):
self.file_path = askopenfilename(filetypes=[('BooguNote Files', '.boo')])
self.dom = parse(self.file_path)
curItem = None
pyBt = PyBooguTree(self.sc.canvas, self.file_path, self.dom)
def new_file(self):
self.file_path = asksaveasfilename()
print(self.file_path)
def writeDom2File(dom, file_path):
f = codecs.open(file_path, 'w', 'utf-8')
dom.writexml(f, encoding='UTF-8')
f.close()
if __name__ == '__main__':
app = Tk()
app.configure(bd=0, bg="yellow")
app.focus_set()
pyBn = PyBooguNote(app)
app.mainloop()
示例8: strftime
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
from tkinter import Tk, StringVar, ttk
import tkinter.simpledialog
import tkinter.messagebox
from time import strftime
now = strftime( "%x %Z %X")
from tkinter import *
import time;
import datetime
#importing the tk fxn from tkinter modual
anthony = Tk()
#config the window+ giving the title
anthony.title("ATTENDANCE REGISTER")
anthony.geometry()
anthony.configure(background="pink")
#creating frames
l_frame = Frame(anthony, width=1000, height=650, bd=8, relief="raised")
l_frame.pack(side=LEFT)
r_frame = Frame(anthony, width=350, height=650, bd=8, relief="raised")
r_frame.pack(side=RIGHT)
#frames in the left frame
l_frame1 = Frame(l_frame, width=1000, height=100, bd=8, relief="raised")
l_frame1.pack(side=TOP)
l_frame2 = Frame(l_frame, width=1000, height=550 , bd=8 , relief="raised")
l_frame2.pack()
#frames in the r.frames
r_frame1 = Frame(r_frame, width=350, height=215, bd=8, relief="raised")
r_frame1.pack(side=TOP)
r_frame2 = Frame(r_frame, width=350, height=415, bd=8, relief="raised")
r_frame2.pack()
示例9: Tk
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
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()
timerA = threading.Timer(3.0, blankScreen)
示例10: Gui
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
from gui import Gui
from time import sleep
from control import defaultControl, Control, Mover
from traceback import print_exc
import socket
from tkinter import Tk, E, W, S, N, Label
from tkinter.font import nametofont
root=Tk()
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
try:
control=defaultControl()
gui = Gui(control, root)
gui.grid(sticky=E+W+S+N)
except (OSError, socket.error) as e:
print_exc()
root.configure(width=200, height=200)
root.bind("<Escape>", lambda x: root.quit())
l=Label(root, text="Нет связи")
l.grid()
nametofont(l["font"]).config(size=80)
root.mainloop()
示例11: Label
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
self.responseLabel.grid(row=23, column=1)
self.emptyRow(24)
lastLine = 21 if not ADMIN_MODE else 25
self.timeLabel = Label(self.fr, textvariable=self.timestring,
anchor='w', bg=bgcolor, fg=statuscolor,
font=("Calibri", 9))
self.timeLabel.grid(row=lastLine, column=0)
self.connLabel = Label(self.fr, textvariable=self.connstring,
anchor='w', bg=bgcolor, fg=statuscolor,
font=("Calibri", 9))
self.connLabel.grid(row=lastLine, column=1)
butexit = Button(self.fr, text="EXIT", width=15, justify='center',
bg="black", fg="yellow", command=self.close,
font=("Calibri", 14, "bold"))
butexit.grid(row=lastLine, column=2)
if __name__ == '__main__':
root = Tk()
root.title('VERTICAL COMPARATOR')
root.geometry(DIMENSIONS)
root.configure(bg=bgcolor)
g = GUI(root)
g.mainDialog()
root.mainloop()
示例12: notify
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
self.myExpensesScrollbar.destroy()#pack(side='right',fill='y') #5
self.scrolBarAcrive = False
def notify(self):
''' Get the value from each question to display them on screen '''
self.total['text'] = str(self.reader.displayTotalSum())
def quitMessage(self,):
'''Exit programme'''
message = messagebox.askyesno(title="Quit", message="Are you sure want to exit?",icon= "warning")
if message:
top.destroy() # On Yes exits application.
if __name__ == "__main__":
top =Tk()
top.configure(bg="white")
user32=ctypes.windll.user32
screenSize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
width=screenSize[0]
height=screenSize[1]
top.geometry(str(width)+"x"+str(height))
top.title("LSBU Informatic Faculty")
top.grid()
app = TaskGUI(top,height,width)
top.mainloop()
示例13: Queue
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
import ctypes
from time import sleep, time
from Settings import *
from GUI import Application
# Define the shared data between the processes
msgQ = Queue(0)
data_array = Array(ctypes.c_ubyte, 50)
if __name__ == '__main__':
# Create the root window
root = Tk()
root.title('KSP Controller')
root.configure(background = "black")
root.geometry('{0}x{1}'.format(c_screen_size_x,c_screen_size_y) + c_screen_pos)
# Instatiate the GUI
app = Application(root, data_array, msgQ)
stage_prev = None
frame_time = time()
# Loop the window, calling an update then refreshing the window
while 1:
if time() > frame_time + 0.250:
frame_time = time()
if app.game_connected == False or app.vessel_connected == False:
app.connect(msgQ)
示例14: buttonCallback
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import configure [as 别名]
def buttonCallback(namn):
print(namn)
def menuCallback(namn):
print(namn)
# Fonts ----------------------------------------------------------------------
bFont = Font(family = 'Arial', size = 10)
aFont = Font(family = 'Arial', size = 8)
# Mainmenu ------------------------------------------------------------------
menuBar = Menu(root)
fileMenu = Menu(menuBar, tearoff = 0)
fileMenu.add_command(label = 'Quit', command = lambda: menuCallback('quit'))
menuBar.add_cascade(label = 'File', menu = fileMenu)
root.configure(menu = menuBar)
# FormulaFrame -------------------------------------------------------------
formulaFrame = Frame(root)
formulaFrame['width'] = 400
formulaFrame['height'] = 40
formulaFrame['relief'] = 'solid'
formulaFrame['borderwidth'] = 1
formulaFrame.grid(columnspan = 3, row = 0, column = 0, sticky = (N, W, E, S))
# Utility Frame -------------------------------------------------------------
utilFrame = Frame(root)