本文整理汇总了Python中tkinter.Tk.geometry方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.geometry方法的具体用法?Python Tk.geometry怎么用?Python Tk.geometry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.geometry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
resolution = load_resolution()
root = Tk()
root.geometry(resolution)
root.wm_title('PiMenu')
if len(sys.argv) > 1 and sys.argv[1] == 'fs':
root.wm_attributes('-fullscreen', True)
app = PiMenu(root)
root.mainloop()
示例2: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
root.geometry("320x350+300+300")
root.resizable(0,0)
app = MainWindow(root)
root.mainloop()
示例3: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
root.geometry("{}x{}+{}+{}".format(700, 500, 300, 300))
app = Window(root)
root.lift()
root.mainloop()
示例4: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
#The geometry() method sets a size for the window and positions it on the screen. The first two parameters are the width and height of the window. The last two parameters are x and y screen coordinates.
root.geometry("250x150+300+300")
app = Example(root)
root.mainloop()
示例5: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
class FileChooser:
def __init__(self):
self.filechooser = Tk()
self.filechooser.geometry('500x500+0+0')
self.button = Button(self.filechooser,text="Add Directory",command=self.addDir)
self.listview = Listbox(self.filechooser)
self.closebutton = Button(self.filechooser,text="Scan",command=self.Done)
self.listview.pack(fill="both")
self.button.pack(fill='x')
helptext = """Select directories by pressing the "Add Directory" Button, then press Scan.
\n When the file tree appears, red text means the file or folder is a duplicate.
\n purple means the folder contains duplicates but itself is not a duplicate.
\n Double Click on red text entries to view matches"""
self.instructions = Label(self.filechooser, text=helptext)
self.instructions.pack(fill='both')
self.closebutton.pack()
self.filechooser.mainloop()
def Done(self):
self.filechooser.destroy()
def addDir(self):
dir = askdirectory()
if os.path.isdir(dir):
dirlist.append(dir)
self.listview.insert('end',str(dir))
示例6: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
root.geometry("1100x450+300+300")
root.resizable(width=False,height=False)
app = Window(root)
root.mainloop()
示例7: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
root.geometry("1400x680+300+300")
root.minsize(1400, 350)
app = windowFrame(root)
root.mainloop()
示例8: _calltip_window
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def _calltip_window(parent): # htest #
import re
from tkinter import Tk, Text, LEFT, BOTH
root = Tk()
root.title("Test calltips")
width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
root.geometry("+%d+%d"%(x, y + 150))
class MyEditWin: # conceptually an editor_window
def __init__(self):
text = self.text = Text(root)
text.pack(side=LEFT, fill=BOTH, expand=1)
text.insert("insert", "string.split")
root.update()
self.calltip = CallTip(text)
text.event_add("<<calltip-show>>", "(")
text.event_add("<<calltip-hide>>", ")")
text.bind("<<calltip-show>>", self.calltip_show)
text.bind("<<calltip-hide>>", self.calltip_hide)
text.focus_set()
root.mainloop()
def calltip_show(self, event):
self.calltip.showtip("Hello world", "insert", "end")
def calltip_hide(self, event):
self.calltip.hidetip()
MyEditWin()
示例9: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
q = Queue()
root = Tk()
root.geometry("400x350+300+300")
Example(root, q)
root.mainloop()
示例10: SelectDataFiles
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def SelectDataFiles():
"""Select the files to compress into a JAM"""
# Draw (then withdraw) the root Tk window
logging.info("Drawing root Tk window")
root = Tk()
logging.info("Withdrawing root Tk window")
root.withdraw()
# Overwrite root display settings
logging.info("Overwrite root settings to basically hide it")
root.overrideredirect(True)
root.geometry('0x0+0+0')
# Show window again, lift it so it can recieve the focus
# Otherwise, it is behind the console window
root.deiconify()
root.lift()
root.focus_force()
# The files to be compressed
jam_files = filedialog.askdirectory(
parent=root,
title="Where are the extracted LEGO.JAM files located?"
)
if not jam_files:
root.destroy()
colors.text("\nCould not find a JAM archive to compress!",
color.FG_LIGHT_RED)
main()
# Compress the JAM
root.destroy()
BuildJAM(jam_files)
示例11: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
window = Tk()
window.geometry('1366x768')
window.attributes('-fullscreen', True)
window.wm_title('GUIDO')
gui = GUI(window)
window.mainloop()
示例12: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk(className="My graphics!")
root.geometry("400x400")
canvas = Canvas()
canvas.pack(fill=BOTH, expand=1)
# img = draw_gradient(canvas)
img = draw_danger_levels(canvas, 50, 50)
# что бы ограничить число
# if n > 255:
# n = 255
# хочу: n = 256 => 0
# n = 257 => 1
# ...
# n = 300 => 44
# 10 // 3 = 3(1)
# 10 - (10 // 3) * 3
# 10 % 3
# a % b < b
# 10 % 3 = 1
# 11 % 3 = 2
# 12 % 3 = 0
# 13 % 3 = 1
root.mainloop()
示例13: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
print("Running...")
root = Tk()
root.geometry("250x150+300+300")
app = Example(root)
root.mainloop()
print("Ran.")
示例14: test
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def test():
"""
Kolorem czarnym są narysowane obiekty utworzone
za pomocą klas fabrycznych.
Kolorem czerwonym obiekty utworzone przy użyciu
funkcji shapeFactory
"""
creator = RectangleCreator()
rect = creator.factory("Rectangle",a=40,b=60)
rect2 = shapeFactory("Rectangle",a=40,b=60, outline="#f00")
creator = TriangleCreator()
tri = creator.factory("Triangle",a=100,b=100,c=100)
tri2 = shapeFactory("Triangle",a=100,b=100,c=100,outline="#f00")
creator = SquareCreator()
sq = creator.factory("Square",a=60)
sq2 = shapeFactory("Square",a=60,outline="#f00")
root = Tk()
w = Window(root)
w.drawShape(rect,100,100)
w.drawShape(rect2,100,200)
w.drawShape(tri,200,100)
w.drawShape(tri2,200,200)
w.drawShape(sq,370,100)
w.drawShape(sq2,370,200)
root.geometry("600x400+100+100")
root.mainloop()
示例15: main
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import geometry [as 别名]
def main():
root = Tk()
root.geometry("927x550+50+50")
root.resizable(width=False, height=False)
app = Example(root)
root.mainloop()