本文整理汇总了Python中tkinter.Tk.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.__init__方法的具体用法?Python Tk.__init__怎么用?Python Tk.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, title="", message="", button="Ok", image=None,
checkmessage="", style="clam", **options):
"""
Create a messagebox with one button and a checkbox below the button:
parent: parent of the toplevel window
title: message box title
message: message box text
button: message displayed on the button
image: image displayed at the left of the message
checkmessage: message displayed next to the checkbox
**options: other options to pass to the Toplevel.__init__ method
"""
Tk.__init__(self, **options)
self.resizable(False, False)
self.title(title)
s = Style(self)
s.theme_use(style)
if image:
Label(self, text=message, wraplength=335,
font="Sans 11", compound="left",
image=image).grid(row=0, padx=10, pady=(10, 0))
else:
Label(self, text=message, wraplength=335,
font="Sans 11").grid(row=0, padx=10, pady=(10, 0))
b = Button(self, text=button, command=self.destroy)
b.grid(row=2, padx=10, pady=10)
self.var = BooleanVar(self)
c = Checkbutton(self, text=checkmessage, variable=self.var)
c.grid(row=1, padx=10, pady=0, sticky="e")
self.grab_set()
b.focus_set()
self.wait_window(self)
示例2: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self,root):
Tk.__init__(self,root)
self.root = root
self.MAX_F = 12
self.info = StringVar()
self.sliders = []
self.parameters = []
self.filters = []
self.isAdvancedMode = False
self.isWritting = False
self.configFile = "config.xml"
self.cw = ConfigWritter(self.configFile)
if not isfile(self.configFile): self._createConfigFile()
self.cp = ConfigParser(self.configFile)
self._parseConfigFile()
self.canvas = Canvas()
self.canvas.pack(expand=YES,fill=BOTH)
self.initialize()
示例3: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
container = Frame(self)
self.title("3d Printer")
#This fied is populated on the first view
#and displayed on the second
self.customer_id = StringVar()
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (CreateCustomerView, ExecuteScriptView):
frame = F(container, self)
self.frames[F] = frame
# put all of the pages in the same location;
# the one on the top of the stacking order
# will be the one that is visible.
frame.grid(row=0, column=0, sticky="nsew")
self.model = CreateCustomerModel()
self.show_frame(CreateCustomerView)
示例4: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, width, height, cellSize,player=None,logicBoard=None):
"""
:param width: largeur du plateau
:param height: hauteur du plateau
:param cellSize: largeur des cases
:param player: joueur
:param logicBoard: plateau logique (liste de liste)
"""
Tk.__init__(self)
self.cellSize = cellSize
self.guiBoard = Canvas(self, width=width, height=height, bg="bisque")
self.currentFixedLabel = FixedLabel(self,"CURRENT PLAYER : ",16,0)
self.currentVariableLabel = VariableLabel(self,18,0,"string")
self.bluePointsFixedLabel = FixedLabel(self,"BLUE CAPTURES : ",16,2)
self.bluePointsVariableLabel = VariableLabel(self,18,2,"integer")
self.redPointsFixedLabel = FixedLabel(self,"RED CAPTURES : ",16,4)
self.redPointsVariableLabel = VariableLabel(self,18,4,"integer")
self.logicBoard=logicBoard
if not(logicBoard):
self.logicBoard=dr.initBoard(DIMENSION)
self.player=player
if not(player):
self.player=1
self.hasPlayed=False
self.hasCaptured=False
self.guiBoard.bind("<Button -1>", self.bindEvent)
self.initiateBoard()
self.guiBoard.grid(rowspan=DIMENSION+1,columnspan=DIMENSION+1,row=0,column=4)
示例5: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, app, kind='', icon_file=None, center=True):
self.findIcon()
Tk.__init__(self)
if center:
pass
self.__app = app
self.configBorders(app, kind, icon_file)
示例6: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
self.make_months()
self['menu'] = self.make_menu()
self.title('Calendar')
self.resizable(width=False, height=False)
# Change this for different size
self.geometry('580x150')
示例7: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
self.container = Frame(self)
self.container.pack(side="top", fill="both", expand=True, padx=20, pady=20)
self.loadWindow = LoadWindow(self.container, self)
self.loadWindow.grid(row=0, column=0, sticky="nesw")
self.showLoadWindow()
示例8: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, parent, title, geometry=None, max=True):
Tk.__init__(self, parent)
self.title(title)
if geometry is not None:
self.geometry(geometry)
w, h = geometry.split("x")
self.minsize(int(w), int(h))
if max:
self.maxsize(int(w), int(h))
self.initialize()
示例9: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, *args, **kwargs):
"""Make boxes, register callbacks etc."""
Tk.__init__(self, *args, **kwargs)
self.wm_title("Horoskop")
self.geometry("{}x{}".format(window_width, window_height))
self.minsize(window_width, window_height)
self.date = DateWidget(self)
self.date.pack(pady=medium_pad)
self.pred = PredictionWidget(self)
self.pred.pack(fill=BOTH, expand=True, padx=big_pad, pady=big_pad)
self.date.setListener(self.pred)
示例10: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self):
Tk.__init__(self)
self.bind("<Escape>", lambda e: self.destroy())
self.bind("<Command-w>", lambda e: self.destroy())
self.bind("<Command-o>", lambda e: self.openDocument())
self.menu = Menu(self, tearoff=0)
self.menu.add_command(label="unzip", command=self.unzip)
self.lists = []
self.lift()
self.attributes('-topmost', True)
self.openDocument()
示例11: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self,root):
Tk.__init__(self,root)
self.root = root
self.trackPath = StringVar()
self.info = StringVar()
self.sliders = []
self.freqs = [32,62,124,220,440,880,1320,1760,2220,2640]
self.canvas = Canvas()
self.canvas.pack(expand=YES,fill=BOTH)
self.initialize()
示例12: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self):
global FMagasin
Tk.__init__(self)
self.title('Donjon & Python')
self.magasin = Magasin.Magasin(self)
self.magasin.grid(row=0, column=0)
Button(self, text='Jouer', command=self.play, height=2, width=20).grid(row=1, column=1)
Button(self,text='Options', command=__main__.ouvrirOption, height=2, width=9).grid(row=1, column=2)
self.framePerso = LabelFrame(self, text='Selection du personnage', width=30)
self.framePerso.grid(row=0, column=1, columnspan=2)
self.OR = Label(self, background='Yellow', height=2, width=70)
self.OR.grid(row=1, column=0)
self.majOR()
self.remplirFramePerso()
示例13: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self):
Tk.__init__(self)
self.title('Templify!')
self.main_frame = ttk.Frame(self)
#basic layout management
self.columnconfigure(0, weight=1, minsize=500)
self.rowconfigure(0, weight=1, minsize=500)
self.main_frame.grid(column=0, row=0,sticky="nesw")
self.option_add('*tearOff', False)
#Start by welcoming the user
self.current_frame = None
self.switch_frame(Frame_type=WelcomeFrame)
示例14: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self):
Tk.__init__(self)
Tk.wm_title(self, 'Five in a Row')
container = Frame(self)
container.pack(side='top', fill='both', expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
frame = GameUI(container, self)
self.frames[GameUI] = frame
frame.grid(row=0, column=0, sticky='nsew')
self.show_frame(GameUI)
示例15: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import __init__ [as 别名]
def __init__(self, filename, title='Tk', preferTk=True):
"""
Initialize a Tk root and created the UI from a JSON file.
Returns the Tk root.
"""
# Needs to be done this way - because base class do not derive from
# object :-(
Tk.__init__(self)
self.preferTk = preferTk
self.title(title)
user_interface = json.load(open(filename)) if os.path.isfile(
filename) else json.loads(filename)
self.create_widgets(self, user_interface)