tkinter
from tkinter import * #import
def main():
screen = Tk()#initialize
screen.geomerty("num1xnum2") #pixels
screen.title("Title")
screen.cofigure(bg = 'grey')#hex colors or normal colors
screen.mainloop()
main()#call
tkinter
from tkinter import * #import
def main():
screen = Tk()#initialize
screen.geomerty("num1xnum2") #pixels
screen.title("Title")
screen.cofigure(bg = 'grey')#hex colors or normal colors
screen.mainloop()
main()#call
basic tkinter gui
import tkinter as tk
root = tk.Tk()
root.title("my title")
root.geometry('200x150')
root.configure(background='black')
# enter widgets here
root.mainloop()
functions calling upon creation tkinter fix
Make your event handler a lambda function, which calls your command() - in this case get_dir()
- with whatever arguments you want:
xbBrowse = Button(frameN, text="Browse...", font=fontReg, command=lambda : self.get_dir(xbPath))
python gui
# App python gui
import tkinter as tk
import webbrowser as wb
def Facebook():
wb.open('facebook.com')
def Instagram():
wb.open('instagram.com')
def Twitter():
wb.open('twitter.com')
def Youtube():
wb.open('youtube.com')
def Google():
wb.open('google.com')
window = tk.Tk()
window.title('Browser')
google = tk.Button(window, text='Google', command=Google)
youtube = tk.Button(window, text='Youtube', bg='red', fg='white', command=Youtube)
twitter = tk.Button(window, text='Twitter', bg='powder blue', fg='white', command=Twitter)
Instagram = tk.Button(window, text='Instagram', bg='white', fg='black', command=Instagram)
facebook = tk.Button(window, text='Facebook', bg='blue', fg='white', command=Facebook)
facebook.pack()
Instagram.pack()
twitter.pack()
youtube.pack()
google.pack()
window.mainloop()
python tkinter
import tkinter as tk
obj = tk.Tk() # Creates a tkinter object
label = tk.Label(obj, text="This is a text button")
python tkinter
import tkinter as tk #import the tkinter module as tk
core = tk.Tk() #makes the core (or root)
mylabel = tk.Label(core, text="Hello world!") #makes a label
mylabel.grid(row=0, column=1) #places the object in a virtual grid
tk.Pack() #Pack the object(s)
core.mainloop()#Make the application a loop (needed)
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