tkinter python 3
import tkinter as tk
obj = tk.Tk() # Creates a tkinter object
label = tk.Label(obj, text="This is a text button")
tkinter python 3
import tkinter as tk
obj = tk.Tk() # Creates a tkinter object
label = tk.Label(obj, text="This is a text button")
tkinter python
from tkinter import *
import time, datetime
from time import gmtime, strftime
root = Tk()
# Window Attributes
root.overrideredirect(1)
root.wm_attributes("-transparentcolor", "gray99")
running = True
# close window
def close(event):
global running
running = False
root.bind('<Escape>', close)
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
timeframe = Frame(root, width=screen_width, height=screen_height, bg="gray99")
timeframe.grid(row=0,column=0)
tkintertime = StringVar()
timelabel = Label(timeframe, textvariable=tkintertime, fg="white", bg="gray99", font=("NovaMono", 40))
timelabel.place(y=screen_height/2 - 60, x=screen_width/2, anchor="center")
tkinterdate = StringVar()
datelabel = Label(timeframe, textvariable=tkinterdate, fg="white", bg="gray99", font=("Bahnschrift", 15))
datelabel.place(y=screen_height/2 + 60, x=screen_width/2, anchor="center")
while running:
tkintertime.set(value=strftime("%H:%M:%S"))
tkinterdate.set(value=strftime("%A, %e %B"))
root.update_idletasks()
root.update()
time.sleep(1)
tkinter python3
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us