Answers for "create window python"

1

how to make a window in python

import tkinter
from tkinter import *

#this makes the window
window = Tk()
#title
window.title("My Window")
#change the size to whatever you want too
window.configure(width = 800, height = 800)
#change the background color to whatever you want too
window.configure(bg = 'black')
#this runs the window
window.mainloop()

#simple way to a window in python
Posted by: Guest on August-05-2021
1

create window python

#---------moving a Window in Center-----------#

from tkinter import *

window = Tk()

window.title("Python GUI App")
window.configure(width=500, height=300)
window.configure(bg='lightgray')

# move window center
winWidth = window.winfo_reqwidth()
winwHeight = window.winfo_reqheight()
posRight = int(window.winfo_screenwidth() / 2 - winWidth / 2)
posDown = int(window.winfo_screenheight() / 2 - winwHeight / 2)
window.geometry("+{}+{}".format(posRight, posDown))

window.mainloop()
Posted by: Guest on October-26-2021
4

python gui

import tkinter as tk
#Importing the main module
window = tk.Tk()
window.mainloop()
Posted by: Guest on October-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language