【发布时间】:2019-02-02 10:43:58
【问题描述】:
我正在制作一个带有三个标签的基本窗口。问题是这些标签有白色背景,我不希望这样。 我希望标签变得没有任何背景,但我不知道。如果有人知道如何解决它,请告诉我。
PD:我用过画布,但是有很多问题,但是我认为制作画布是解决方案,但我不知道该怎么做
截图:
代码:
from tkinter import *
import winsound
from winsound import *
from tkinter import messagebox
import time
#creamos la ventana
raiz=Tk()
raiz.title("MYRIAD ALLIANCE: ORIGINS")
raiz.geometry("900x550")
raiz.resizable(0,0)
raiz.iconbitmap("C:\\Users\\shado\\Desktop\\Myadorigins\\descarga.ico")
#winsound.PlaySound('C:\\Users\\shado\\Downloads\\pygame\\MY\\dark.wav', winsound.SND_ALIAS | winsound.SND_ASYNC)
#----------------------aa
def ventanas(frame):
frame.tkrise()
def jugar():
messagebox.showinfo("Próximamente...", "Esta opción estará disponible próximamente...")
def quitar():
if messagebox.askokcancel("Saliendo...", "¿Estas seguro de que quieres salir?"):
raiz.destroy()
def clickDerecho(event):
jugar()
def clickDerecho2(event):
quitar()
#frames--------------------------------------------------------------------
frameJugar = Frame()
fondo = PhotoImage(file= r'C:\Users\shado\Desktop\Myadorigins\background.png')
background_label = Label(raiz, image=fondo)
background_label.place(x=0, y=0, relwidth=1, relheight=1)
texto = Label(raiz, text="JUGAR" ,bd=0, font=("COMIC SANS MS", 30, "italic"), fg="#00deff", cursor="hand2")
texto.bind("<Button-1>", clickDerecho)
texto.place(x=100, y=196)
texto2 = Label(raiz, text="TUTORIAL" ,bd=0, font=("COMIC SANS MS", 30, "italic"), fg="#00deff", cursor="hand2")
texto2.bind("<Button-1>", clickDerecho)
texto2.place(x=100, y=306)
texto3 = Label(raiz, text="SALIR" ,bd=0, font=("COMIC SANS MS", 30, "italic"), fg="#00deff", cursor="hand2")
texto3.bind("<Button-1>", clickDerecho2)
texto3.place(x=100, y=416)
#-----------------------------------------------------------------ejecutamos la ventana
raiz.protocol("WM_DELETE_WINDOW", quitar)
raiz.mainloop()
【问题讨论】:
标签: python tkinter background label