Stack Overflow en español es un sitio de preguntas y respuestas para programadores y profesionales de la informática. Solo te toma un minuto registrarte.
Regístrate para unirte a esta comunidad
def proyecto():
def salir_app():
if messagebox.askyesno('Atencion','Se dispone a Salir del Administrador de proyectos.') == True:
app.deiconify()
proyecto.destroy()
proyecto=Toplevel()
proyecto.resizable(0,0)
proyecto.config(bg='Black')
proyecto.overrideredirect(True)
fontStyle = tkFont.Font(family="Lucida Grande", size=20)
fontStyle1 = tkFont.Font(family="Lucida Grande", size=30)
fontStyle2 = tkFont.Font(family="Lucida Grande", size=10)
#----------------------------TAMANO Y POSISION DE LA VENTANA----------------------------------
ancho_ventana = 500
alto_ventana = 500
x_ventana = proyecto.winfo_screenwidth() // 2 - ancho_ventana // 2
y_ventana = proyecto.winfo_screenheight() // 2 - alto_ventana // 2
posicion = str(ancho_ventana) + "x" + str(alto_ventana) + "+" + str(x_ventana) + "+" + str(y_ventana)
proyecto.geometry(posicion)
proyecto.resizable(0,0)
proyecto.title("DGQ-PROYECT MANAGER")
#----------------------------TAMANO Y POSISION DE LA VENTANA----------------------------------
Label(proyecto, text='PROJECT MANAGEMENT BY', bg='Black',fg='White',font=fontStyle).place(x=10, y=5)
Label(proyecto, text='DGQ', bg='Black',fg='Red',font=fontStyle1).place(x=390, y=0)
espacio=LabelFrame(proyecto, text='TOOLS Proyect:', bg='Black',fg='White')
espacio.place(x=10,y=50,width=239,height=125)
Button(espacio, text="New!",width=10, command=salir_app, bg='Black',fg='Green').place(x=10, y=10)
Button(espacio, text="Edit!",width=10, command=salir_app, bg='Black',fg='Yellow').place(x=10, y=40)
Button(espacio, text="Delete!",width=10, command=salir_app, bg='Black',fg='Red').place(x=10, y=70)
espacio1=LabelFrame(proyecto, text='EXTRA TOOLS:', bg='Black',fg='White')
espacio1.place(x=250,y=50,width=240,height=125)
Button(espacio1, text="Employees!",width=10,command=salir_app, bg='Black',fg='Green').place(x=10, y=10)
Button(espacio1, text="Exit!",width=10,command=salir_app, bg='Black',fg='Red').place(x=10, y=70)
#------------------------------------------------------------------------------------------------------
Label(proyecto,text='Registered Jobs:', bg='Black',fg='White',font=fontStyle2).place(x=10, y=180)
Label(proyecto,text='Registered Employees:', bg='Black',fg='White',font=fontStyle2).place(x=250, y=180)
cantidad_trabajos=StringVar()
Entry(proyecto,textvariable=cantidad_trabajos,width=5, state ='readonly').place(x=115, y=182)
cantidad_empleados=StringVar()
Entry(proyecto,textvariable=cantidad_empleados,width=5, state ='readonly').place(x=395, y=182)
#-------------------------------------------------------------------------------------------------------
tree = ttk.Treeview(proyecto, height = 12, columns=3)#LLAMAMOS AL TREEVIEW
tree.place(x=10, y=222.5, width= 480)#LO POSICIONAMOS EN LA APP
proyecto.mainloop()
introducir el código aquí
proyecto()
Buen día,
Puedes lograrlo utilizando un estilo y un tema para tu ventana
Agregando las siguientes líneas a tu código:
# Configurar el estilo y tema
style = ttk.Style(proyecto)
style.theme_use("clam")
# Configurar las propiedades de Treeview
style.configure("Treeview", background="black", fieldbackground="black", foreground="white")
Ejemplo:
from tkinter import *
from tkinter import messagebox
import os
import sqlite3
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
import shutil
from PIL import ImageTk, Image
import tkinter.font as tkFont
def proyecto():
def salir_app():
if messagebox.askyesno('Atencion','Se dispone a Salir del Administrador de proyectos.') == True:
app.deiconify()
proyecto.destroy()
proyecto=Toplevel()
proyecto.resizable(0,0)
proyecto.config(bg='Black')
proyecto.overrideredirect(True)
fontStyle = tkFont.Font(family="Lucida Grande", size=20)
fontStyle1 = tkFont.Font(family="Lucida Grande", size=30)
fontStyle2 = tkFont.Font(family="Lucida Grande", size=10)
#----------------------------TAMANO Y POSISION DE LA VENTANA----------------------------------
ancho_ventana = 500
alto_ventana = 500
x_ventana = proyecto.winfo_screenwidth() // 2 - ancho_ventana // 2
y_ventana = proyecto.winfo_screenheight() // 2 - alto_ventana // 2
posicion = str(ancho_ventana) + "x" + str(alto_ventana) + "+" + str(x_ventana) + "+" + str(y_ventana)
proyecto.geometry(posicion)
proyecto.resizable(0,0)
proyecto.title("DGQ-PROYECT MANAGER")
#----------------------------TAMANO Y POSISION DE LA VENTANA----------------------------------
Label(proyecto, text='PROJECT MANAGEMENT BY', bg='Black',fg='White',font=fontStyle).place(x=10, y=5)
Label(proyecto, text='DGQ', bg='Black',fg='Red',font=fontStyle1).place(x=390, y=0)
espacio=LabelFrame(proyecto, text='TOOLS Proyect:', bg='Black',fg='White')
espacio.place(x=10,y=50,width=239,height=125)
Button(espacio, text="New!",width=10, command=salir_app, bg='Black',fg='Green').place(x=10, y=10)
Button(espacio, text="Edit!",width=10, command=salir_app, bg='Black',fg='Yellow').place(x=10, y=40)
Button(espacio, text="Delete!",width=10, command=salir_app, bg='Black',fg='Red').place(x=10, y=70)
espacio1=LabelFrame(proyecto, text='EXTRA TOOLS:', bg='Black',fg='White')
espacio1.place(x=250,y=50,width=240,height=125)
Button(espacio1, text="Employees!",width=10,command=salir_app, bg='Black',fg='Green').place(x=10, y=10)
Button(espacio1, text="Exit!",width=10,command=salir_app, bg='Black',fg='Red').place(x=10, y=70)
#------------------------------------------------------------------------------------------------------
Label(proyecto,text='Registered Jobs:', bg='Black',fg='White',font=fontStyle2).place(x=10, y=180)
Label(proyecto,text='Registered Employees:', bg='Black',fg='White',font=fontStyle2).place(x=250, y=180)
cantidad_trabajos=StringVar()
Entry(proyecto,textvariable=cantidad_trabajos,width=5, state ='readonly').place(x=115, y=182)
cantidad_empleados=StringVar()
Entry(proyecto,textvariable=cantidad_empleados,width=5, state ='readonly').place(x=395, y=182)
#-------------------------------------------------------------------------------------------------------
# Configurar el estilo y tema
style = ttk.Style(proyecto)
style.theme_use("clam")
# Configurar las propiedades de Treeview
style.configure("Treeview", background="black", fieldbackground="black", foreground="white")
tree = ttk.Treeview(proyecto, height = 12, columns=3)#LLAMAMOS AL TREEVIEW
tree.place(x=10, y=222.5, width= 480)#LO POSICIONAMOS EN LA APP
proyecto.mainloop()
#introducir el código aquí
proyecto()
Esto crea la siguiente ventana
¡Gracias por contribuir en StackOverflow en español con una respuesta!
- Por favor, asegúrate de responder a la pregunta. ¡Proporciona información y comparte tu investigación!
Pero evita…
- Pedir ayuda o aclaraciones, o responder a otras respuestas.
- Hacer declaraciones basadas en opiniones; asegúrate de respaldarlas con referencias o con tu propia experiencia personal.
Para obtener más información, consulta nuestros consejos sobre cómo escribir grandes respuestas.