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
tkinter
from tkinter import *
from tkinter import ttk
root=Tk()
entry1=Entry(root,cursor="fleur",insertbackground="red")
entry1.pack()
Button(root,text="Get cursor type and colour", command=lambda: print(entry1['cursor'],entry1['insertbackground'])).pack()
root.mainloop()
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()
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
from tkinter import * # import tkinter
window = Tk() #create a window
window.mainloop() #update window
tkinter
#The (!) is the not operator in Python, (!=) means not equal to.
if 2!=10:
print("2 isn't equal to 10.")
elif 2==10:
print("2 is equal to 10.")
#Prints "2 isn't equal to 10." as 2 isn't equal to 10. Is it?
#Note that "=" is used for declarations (assign a value to a variable or change the value of one) while "==" is usually used for checking.
#Usually, "==" returns a boolean, but depends on the objects being checked if they're equal or not, that the result will be boolean.
#For example, some NumPy objects when checked will return values other than boolean (other than True or False).
#For example:
a = 10
print(a)
#will return the int 10
#Now,
print(a==10)
#will return a boolean, True as we have assigned the value of a as 10
#Another example (to make it easier and to avoid confusion) would be where
a = 10
b = 10
#and
print(a==b)
#will return a boolean, True as they're equal.
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