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


Python Tk.title方法代码示例

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


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

示例1: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main():
    global drawing_area

    root = Tk()
    root.title("Drawer")
    drawing_area = Canvas(root, width=300, height=300, bg="white")

    # Binding Events to the canvas
    drawing_area.bind("<B1-Motion>", drag)
    drawing_area.bind("<ButtonRelease-1>", drag_end)
    drawing_area.pack()

    # Buttons
    # Quit Button
    b1 = Button(root, text="Quit")
    b1.pack()
    b1.bind("<Button-1>", quit)

    # Clear Button
    b2 = Button(root, text="Clear")
    b2.pack()
    b2.bind("<Button-1>", clear)

    # Save Button
    b3 = Button(root, text="Save")
    b3.pack()
    b3.bind("<Button-1>", save)
    root.mainloop()
开发者ID:ahmedadelhassan,项目名称:CharacterRecognition,代码行数:30,代码来源:drawer.py

示例2: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main(argv=sys.argv):
    filename = None

    parser = OptionParser()
    parser.add_option("-g", "--geometry", dest="geometry", default="1000x600",
                      help="location and size of window", metavar="GM")
    parser.add_option("-d", "--depth", dest="depth", default=7,
                      type=int, help="how many rows to show in each stack", metavar="DEPTH")
    (options, args) = parser.parse_args(argv)

    # lol constants
    global MAX_DEPTH
    MAX_DEPTH = options.depth

    if len(args) > 1:
        filename = args[1]

    if not have_tk:
        print("Couldn't find Tk libraries")
        return 1

    # set up the root window early, so we can control it (and hide it)
    # by default, showerror() will create a random blank window as root
    root = Tk()
    set_icon(root, "images/tools-icon")
    root.title(NAME)

    _App(root, filename)
    if options.geometry:
        root.geometry(options.geometry)
    root.mainloop()

    return 0
开发者ID:shish,项目名称:context,代码行数:35,代码来源:main.py

示例3: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main():
    fileWords = open('wordList.txt')
    fileWords = fileWords.read()
    fileWords = fileWords.split()
    def clear():
        os.system('cls' if platform.system() == "Windows" else "clear")
        
    def whenClicked(*args):
        prefix = pattern.get()
        labelText.set("")
        for word in fileWords:
            if word.startswith(prefix):
                labelText.set(str(labelText.get())+'\n'+word)
    
        
        
    root = Tk()
    root.title('AutoComplete')
    ttk.Label(root, text='Enter search pattern').pack()
    pattern = StringVar()
    ttk.Entry(root, textvariable=pattern).pack()
    ttk.Button(root, text='Submit', command=whenClicked).pack()
    labelText = StringVar()
    ttk.Label(root, textvariable=labelText).pack()
    root.bind('<Return>', whenClicked)
    root.mainloop()
开发者ID:MiguelSOliveira,项目名称:Python-Projects,代码行数:28,代码来源:AutoComplete.py

示例4: directions_window

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
    def directions_window():
        directions_window = Tk()
        directions_window.title("How To Operate The Board")

        label = Label(directions_window, text="Left Click to pick a piece \n Right Click to place the piece", height=20,
                      width=50)
        label.pack()
开发者ID:LilCheabs,项目名称:Chess,代码行数:9,代码来源:Chess.py

示例5: __init__

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
class FileExportDialog:

##### Initialization ####################################################################
	
	def __init__( self, main, dataInstance, axes ):
		"""Initializes the file saving dialog."""
		self.main = main
		self.dataInstance = dataInstance
		self.axes = axes
		
		self.root = Tk()
		self.root.title( "Export As ARFF" )
		self.root.geometry( "350x100" )
		
		Label( self.root, text="Choose options for save." ).grid( row=0, columnspan=2 )
		
		Label(self.root, text="Filename").grid( row=1,column=0, sticky=tk.W )
		self.main.saveFileName = StringVar( self.root )
		fileNameField = Entry( self.root, textvariable=self.main.saveFileName )
		fileNameField.grid(row=1, column=1)
		
		def callback():
			self.root.destroy()
			self.main.writeARFFFile()
				
		b1 = Button( self.root, text="Confirm", command=callback )
		b1.grid( row=3, columnspan=2 )
开发者ID:TheTourer,项目名称:VIOLASv2,代码行数:29,代码来源:dialogPop.py

示例6: ABC

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
class ABC(Frame):

    def __init__(self,parent=None):
        Frame.__init__(self,parent)
        self.parent = parent
        self.pack() # Pack.config(self)  # same as self.pack()
        ABC.make_widgets(self)
        Button(self, text='Pop1', command=self.dialog1).pack()
        enable = {'ID1050': 0, 'ID1106': 0, 'ID1104': 0, 'ID1102': 0}
        for machine in enable:
            enable[machine] = Variable()
            l = Checkbutton(self, text=machine, variable=enable[machine])
            l.pack()

        self.pack()


    def make_widgets(self):
        self.root = Tk()
        self.root.title("Simple Prog")

    def dialog1(self):
        ans = Dialog(self,
                     title   = 'Title!',
                     text    = 'text'
                               'and text "quotation".',
                     bitmap  = 'questhead',
                     default = 0, strings = ('Yes', 'No', 'Cancel'))
开发者ID:BaldyBadgersRunningRoundMyBrain,项目名称:kali-scripts,代码行数:30,代码来源:kali.py

示例7: __init__

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
    def __init__(self, drs, size_canvas=True, canvas=None):
        """
        :param drs: C{AbstractDrs}, The DRS to be drawn
        :param size_canvas: bool, True if the canvas size should be the exact size of the DRS
        :param canvas: C{Canvas} The canvas on which to draw the DRS.  If none is given, create a new canvas. 
        """
        master = None
        if not canvas:
            master = Tk()
            master.title("DRT")
    
            font = Font(family='helvetica', size=12)
            
            if size_canvas:
                canvas = Canvas(master, width=0, height=0)
                canvas.font = font
                self.canvas = canvas
                (right, bottom) = self._visit(drs, self.OUTERSPACE, self.TOPSPACE)
                
                width = max(right+self.OUTERSPACE, 100)
                height = bottom+self.OUTERSPACE
                canvas = Canvas(master, width=width, height=height)#, bg='white')
            else:
                canvas = Canvas(master, width=300, height=300)
                
            canvas.pack()
            canvas.font = font

        self.canvas = canvas
        self.drs = drs
        self.master = master
开发者ID:gijs,项目名称:nltk,代码行数:33,代码来源:drt.py

示例8: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main(
  title,
  shell,
  world,
  text=None,
  text_file_name=None,
  initial=None,
  save_file=None,
  commit_thing=None,
  ):

  tk = Tk()
  tk.title(title)
  t = shell(tk, text_file_name)
  w = world(
    t.text,
    t.view,
    initial=initial,
    save_file=save_file,
    commit_thing=commit_thing,
    )

  if text is None:
    stack, dictionary = w.getCurrentState()
    words = (name for name, value in items(dictionary))
    text = 'Words: ' + ' '.join(words) + '\n'

  t.text.insert(END, text)

  tk.mainloop()
开发者ID:PhoenixBureau,项目名称:PigeonComputer,代码行数:32,代码来源:__init__.py

示例9: f10_1

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
    def f10_1():
        def fe():
            root4.destroy()

        begin_lon = 0
        try:
            begin_lon = (float)(E1.get())
        except:
            print 'no enter a float number'
        print begin_lon

        c.execute('DELETE FROM info WHERE latitude>?', (begin_lon,))

        conn.commit()
        DBtoCSV()
        root2.destroy()

        root4 = Tk()
        root4.title("end time")
        root4.geometry("600x200")
        ButtonCSV = Button(root4, text="convert to csv", width=100, fg='red', font=16, command=DBtoCSV2)
        ButtonCSV.pack()

        ButtonKML = Button(root4, text="convert to kml", width=100, fg='red', font=16, command=DBtoKML)
        ButtonKML.pack()

        ButtonEXIT = Button(root4, text="exit", width=100, fg='red', font=16, command=fe)
        ButtonEXIT.pack()
开发者ID:e5r5,项目名称:Ex2,代码行数:30,代码来源:run_Ex2.py

示例10: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main():
	""" Main method of everything """
	#print "\t Starting ... in time: ", strftime("%a, %d %b %Y %X", gmtime()), "\n"

	#print "\t Running ... in time: ", strftime("%a, %d %b %Y %X", gmtime()), "\n"

	#print "\t Recording ... in time: ", strftime("%Y-%m-%d %H:%M:%S", gmtime()), "\n"

	#print "\t Ending ... in time: ", strftime("%Y-%m-%d %H:%M:%S", gmtime()), "\n"


	# create the root window
	root = Tk()

	# modify the window
	root.title("Auto visual police system")
	root.geometry("1000x800")

	

	Button(root, text="Ukončit celý system", command=root.destroy).pack()

	for cam in xrange(numberOfCams):
		Button(root, text="Kamera číslo: "+str(cam), command=root.destroy).pack(padx=5, pady=10, fill=X, side="left")

	# Start the window's event-loop
	root.mainloop()
开发者ID:DHIndM,项目名称:AutoVisPolSys,代码行数:29,代码来源:AutVisPolSys.py

示例11: _load_gui

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
    def _load_gui(self):
        root = Tk()
        root.title("Scraper")
        main_frame = Frame(root)
        main_frame.grid(column=0, row=0, sticky=(N, W, E, S))
        main_frame.columnconfigure(0, weight=1)
        main_frame.rowconfigure(0, weight=1)
        main_frame.pack()
        
        self.scale_red_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_red_min)
        self.scale_red_min.grid(column=1, row=1)
       
        self.scale_red_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_red_max)
        self.scale_red_max.grid(column=2, row=1)
        self.scale_red_max.set(255)
        
        self.scale_green_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_green_min)
        self.scale_green_min.grid(column=1, row=2)

        self.scale_green_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_green_max)
        self.scale_green_max.grid(column=2, row=2)
        self.scale_green_max.set(255)

        self.scale_blue_min = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_blue_min)
        self.scale_blue_min.grid(column=1, row=3)
        
        self.scale_blue_max = Scale(main_frame, from_=0, to=255, orient=HORIZONTAL, command=self._update_blue_max)
        self.scale_blue_max.grid(column=2, row=3)
        self.scale_blue_max.set(255)
        return root
开发者ID:protobuf,项目名称:dsbot,代码行数:32,代码来源:scraper.py

示例12: init_master

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def init_master():
    """初始化主窗口"""
    global master
    master = Tk()
    master.title(u'花田')
    master.geometry(u'630x530')
    master.resizable(width=False, height=False)
开发者ID:WiseDoge,项目名称:huatian-funny,代码行数:9,代码来源:mark.py

示例13: main

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
def main():
    DEFAULTVALUE_OPTION = 'Restart (choose color from list)'
    root = Tk() 
    root.title('Lets Play Alien Tiles!')
    root.geometry('478x340') 
    root.configure(background='black')
    row = 1
    global buttons
    for i in range(7):
	for j in range(7):
		b = tk.Button(text="0",command= lambda x1=i, y1=j: pressed(x1,y1), bg = 'red', width=5)
		b.grid(row = i, column = j)
		buttons.append(b)
    pattern = tk.Label(text="Pattern")
    pattern.grid( row = 8, column = 2, columnspan=3, sticky=W+E)
    global entry
    entry = tk.Entry(bd =5)
    entry.grid(row=9, column = 1, columnspan=5, sticky=W+E)
    bo = tk.Button(text="Original Page",command=web)
    bo.grid( row = 14, column = 5, columnspan=2, padx = 15, pady = 15)

    optionList = ('Restart (choose color from list)','red', 'green', 'blue', 'purple')
    global v
    v = StringVar()
    v.set(optionList[0])
    defaultOption = StringVar()
    om = OptionMenu(root, v, *optionList)
    defaultOption.set(DEFAULTVALUE_OPTION)
    om.grid(  row = 13, column = 0, columnspan=4, pady = 10)
    confirm = tk.Button(text="Confirm",command=restart)
    confirm.grid( row = 14, column = 1, columnspan=2)
    confirm.place(anchor= SE, x=160, y=320)
    
    root.mainloop()  
开发者ID:tchalas,项目名称:python-heuristicfunctions,代码行数:36,代码来源:graph.py

示例14: Display

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
class Display(object):
    '''
    classdocs
    '''
    TITLE = 'House Monitor'

    TIME_COLUMN = 0
    NAME_COLUMN = 1
    VALUE_COLUMN = 2

    mainframe = None
    proxy = None

    current_row = 0

    current_values = {}

    def __init__(self, current_values):
        '''
        Constructor
        '''
        self.current_values = current_values
        super(Display, self).__init__()
        self.root = Tk()
        self.root.title(self.TITLE)
#        self.mainframe = Frame(self.root, padding="3 3 12 12")

        self.mainframe = Frame(self.root)
        self.mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
        self.mainframe.columnconfigure(0, weight=1)
        self.mainframe.rowconfigure(0, weight=1)
        print(current_values)

#        self.display_header()

    def display_header(self):
        Tk.Label(self.mainframe, text='Time', width=15, background='lightblue').grid(column=self.TIME_COLUMN, row=self.current_row, sticky=W)
        Tk.Label(self.mainframe, text='Name', width=45, background='lightblue').grid(column=self.NAME_COLUMN, row=self.current_row, sticky=W)
        Tk.Label(self.mainframe, text='Value', width=15, background='lightblue').grid(column=self.VALUE_COLUMN, row=self.current_row, sticky=W)
        self.current_row = self.current_row + 1

    def update(self):
        self.current_row = 1
        for device in self.current_values.keys():
            for port in self.current_values[device].keys():

                arrival_time = self.current_values[device][port]['arrival_time']
                Tk.Label(self.mainframe, text=arrival_time).grid(column=self.TIME_COLUMN, row=self.current_row, sticky=W)

                name = self.current_values[device][port]['name']
                Tk.Label(self.mainframe, text=name).grid(column=self.NAME_COLUMN, row=self.current_row, sticky=W)

                value = self.current_values[device][port]['current_value']
                units = self.current_values[device][port]['units']
                value = '{}{}'.format(value, units)
                Tk.Label(self.mainframe, text=value).grid(column=self.VALUE_COLUMN, row=self.current_row, sticky=W)
                self.current_row = self.current_row + 1

    def run(self):
        self.root.mainloop()
开发者ID:gary-pickens,项目名称:HouseMonitor,代码行数:62,代码来源:display.py

示例15: Wall

# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import title [as 别名]
class Wall(object):
    MIN_RED = MIN_GREEN = MIN_BLUE = 0x0
    MAX_RED = MAX_GREEN = MAX_BLUE = 0xFF

    PIXEL_WIDTH = 96

    def __init__(self, width, height):
        self.width = width
        self.height = height
        self._tk_init()
        self.pixels = [(0, 0, 0) for i in range(self.width * self.height)]

    def _tk_init(self):
        self.root = Tk()
        self.root.title("ColorWall %d x %d" % (self.width, self.height))
        self.root.resizable(0, 0)
        self.frame = Frame(self.root, bd=5, relief=SUNKEN)
        self.frame.pack()

        self.canvas = Canvas(self.frame,
                             width=self.PIXEL_WIDTH * self.width,
                             height=self.PIXEL_WIDTH * self.height,
                             bd=0, highlightthickness=0)
        self.canvas.pack()
        self.root.update()

    def set_pixel(self, x, y, hsv):
        self.pixels[self.width * y + x] = hsv

    def get_pixel(self, x, y):
        return self.pixels[self.width * y + x]

    def draw(self):
        self.canvas.delete(ALL)
        for x in range(len(self.pixels)):
            x_0 = (x % self.width) * self.PIXEL_WIDTH
            y_0 = (x / self.width) * self.PIXEL_WIDTH
            x_1 = x_0 + self.PIXEL_WIDTH
            y_1 = y_0 + self.PIXEL_WIDTH
            hue = "#%02x%02x%02x" % self._get_rgb(self.pixels[x])
            self.canvas.create_rectangle(x_0, y_0, x_1, y_1, fill=hue)
        self.canvas.update()

    def clear(self):
        for i in range(self.width * self.height):
            self.pixels[i] = (0, 0, 0)

    def _hsv_to_rgb(self, hsv):
        rgb = colorsys.hsv_to_rgb(*hsv)
        red = self.MAX_RED * rgb[0]
        green = self.MAX_GREEN * rgb[1]
        blue = self.MAX_BLUE * rgb[2]
        return (red, green, blue)

    def _get_rgb(self, hsv):
        red, green, blue = self._hsv_to_rgb(hsv)
        red = int(float(red) / (self.MAX_RED - self.MIN_RED) * 0xFF)
        green = int(float(green) / (self.MAX_GREEN - self.MIN_GREEN) * 0xFF)
        blue = int(float(blue) / (self.MAX_BLUE - self.MIN_BLUE) * 0xFF)
        return (red, green, blue)
开发者ID:Ray-SunR,项目名称:colorwall,代码行数:62,代码来源:wall.py


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