- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我做了一个 带有 .py 和 cx_Freeze 的 .exe 应用程序 .
我可以打开我的应用程序并将其放在屏幕底部的 Windows 任务栏中,但是当我打开它时 不打开标签 就像当你打开一个应用程序时会出现一个选项卡,当我去其他地方时 我的应用程序消失 ... 我可以看到我的应用程序在 中任务管理器但真的无处……
更新 :所有这一切都归功于这一行:win.overrideredirect(True)
在我的应用程序代码中,但我不知道该怎么做,我什么也没找到……
# -*- Encoding:Latin-1 -*-
import os
import math
import tkinter as tk
from tkinter import *
from tkinter import font
win = tk.Tk()
win.overrideredirect(True)
win.geometry('+400+100')
font1 = font.Font(family = 'Helvetica', size = 15)
font3 = font.Font(family = 'Helvetica', size = 8, weight = 'bold')
font2 = font.Font(family = 'Helvetica', size = 20, weight = 'bold')
def aaa(colora, colorb, colorc, colord, colore, colorf):
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
Ecrire('',Light)
def aaaa(colora, colorb, colorc, colord, colore, colorf):
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#C47ED6")
Ecrire('',Dark)
def strl(list):
list ="".join(list)
return list
pixel = tk.PhotoImage(width=1, height=1)
a =95
b =95
theme = 0
t = 0
ecrit = []
nombre_de_multdiv = 0
nombre_de_sous_add = 0
def Del(self):
global ecrit
del ecrit[-1]
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Del_all(self):
global ecrit
del ecrit[:]
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Ecrire(symbole,self):
ecrit.append(symbole)
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Ecrire_Resulat(valeur,self):
valeur = strl(valeur)
self.label1['text'] = valeur
def Calcul(self):
global nombre_de_multdiv
global nombre_de_sous_add
for i in range(len(ecrit)):
if ecrit[i] == '/' or ecrit[i] == '*':
nombre_de_multdiv +=1
for i in range(len(ecrit)):
if ecrit[i] == '+' or ecrit[i] == '-':
nombre_de_sous_add +=1
for i in range(nombre_de_multdiv):
for i in range(len(ecrit)):
if ecrit[i] == '*' or ecrit[i] == '/':
numero = i
nb = i
nbb = i
for i in range(len(ecrit)-numero-1):
if ecrit[i+1 + numero] != '/' and ecrit[i+1 + numero] != '*' and ecrit[i+1 + numero] != '+' and ecrit[i+1 + numero] != '-':
nb +=1
elif ecrit[i+1+numero] == '/' or ecrit[i+1+numero] == '*' or ecrit[i+1+numero] == '+' or ecrit[i+1+numero] == '-':
break
for i in range(numero):
i = -i
if ecrit[i-1+numero] != '/' and ecrit[i-1+numero] != '*' and ecrit[i-1+numero] != '+' and ecrit[i-1+numero] != '-':
nbb -=1
elif ecrit[i-1+numero] == '/' or ecrit[i-1+numero] == '*' or ecrit[i-1+numero] == '+' or ecrit[i-1+numero] == '-':
break
nombre1 = "".join(ecrit[numero+1:nb+1])
nombre1 = float(nombre1)
nombre2 = "".join(ecrit[nbb:numero])
nombre2 = float(nombre2)
if ecrit[numero] =='*':
resultat = nombre1 * nombre2
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
else:
resultat = nombre2 / nombre1
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
del ecrit[nbb:nb+1]
for i in range(len(resultat)):
ecrit.insert(nbb+i,resultat[i])
break
for i in range(nombre_de_sous_add):
for i in range(len(ecrit)):
if ecrit[i] == '+' or ecrit[i] == '-':
numero = i
nb = i
nbb = i
for i in range(len(ecrit)-numero-1):
if ecrit[i+1 + numero] != '/' and ecrit[i+1 + numero] != '*' and ecrit[i+1 + numero] != '+' and ecrit[i+1 + numero] != '-':
nb +=1
elif ecrit[i+1+numero] == '/' or ecrit[i+1+numero] == '*' or ecrit[i+1+numero] == '+' or ecrit[i+1+numero] == '-':
break
for i in range(numero):
i = -i
if ecrit[i-1+numero] != '/' and ecrit[i-1+numero] != '*' and ecrit[i-1+numero] != '+' and ecrit[i-1+numero] != '-':
nbb -=1
elif ecrit[i-1+numero] == '/' or ecrit[i-1+numero] == '*' or ecrit[i-1+numero] == '+' or ecrit[i-1+numero] == '-':
break
nombre1 = "".join(ecrit[numero+1:nb+1])
nombre1 = float(nombre1)
nombre2 = "".join(ecrit[nbb:numero])
nombre2 = float(nombre2)
if ecrit[numero] =='+':
resultat = nombre1 + nombre2
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
else:
resultat = nombre2 - nombre1
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
del ecrit[nbb:nb+1]
for i in range(len(resultat)):
ecrit.insert(nbb+i,resultat[i])
break
Ecrire_Resulat(ecrit,self)
class Theme():
def move_window(self,event):
win.geometry('+{0}+{1}'.format(event.x_root - self.x, event.y_root - self.y))
def set_xy(self,event):
self.x=event.x_root - win.winfo_x()
self.y=event.y_root - win.winfo_y()
return self.x,self.y;
def boutontheme(self,colora, colorb, colorc, colord, colore, colorf):
self.openmenu(colora, colorb, colorc, colord, colore, colorf)
if self.t == 0:
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#915ec4")
self.t = 1
Ecrire('',Light)
else:
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
self.t = 0
Ecrire('',Dark)
def openmenu(self,colora, colorb, colorc, colord, colore, colorf):
if self.ouvert == False:
self.b_theme.config(bg = colore)
if self.t == 0:
self.b_theme_dark = tk.Button(win,state=DISABLED, text = 'Dark theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_light = tk.Button(win,state=NORMAL, text = 'Light theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
else:
self.b_theme_dark = tk.Button(win,state=NORMAL, text = 'Dark theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_light = tk.Button(win,state=DISABLED, text = 'Light theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_dark.place(anchor = 'nw', x = 5, y = 25)
self.b_theme_light.place(anchor = 'nw', x = 5, y = 45)
self.ouvert = True
return;
if self.ouvert == True:
self.b_theme.config(bg = colorb)
self.b_theme_dark.destroy()
self.b_theme_light.destroy()
self.ouvert = False
return;
def __init__(self,colora, colorb, colorc, colord, colore, colorf):
if colora == '#18181F':
self.t = 0
else:
self.t = 1
self.ouvert = False
self.x = 0
self.y=0
#creation menu
self.canvas_menu = Canvas(win, width =500, height =25, bg = colora, borderwidth=0, highlightthickness=0)
self.exit = Canvas(bg = colora,borderwidth=0, highlightthickness=0)
self.exit.create_oval(0,0,20,20, fill= colore,width = 0)
self.exit.create_text(10, 10, text="x", fill = colord, font= font3)
self.exit.bind("<Button-1>", lambda e: win.destroy())
#affichage menu
self.exit.place(anchor = 'nw', x = 475, y = 2)
self.canvas_menu.grid(row = 0,column = 0, columnspan = 5)
#creation des canvas
self.canvas_screen = Canvas(win, width =500, height =100, bg =colorb,borderwidth=0, highlightthickness=0)
self.canvas_keyb_num = Canvas(win, width =300, height =400, bg =colorb,borderwidth=0, highlightthickness=0)
self.canvas_keyb_op = Canvas(win, width =200, height =400, bg =colorb,borderwidth=0, highlightthickness=0)
#affchage des canvas
self.canvas_screen.grid(row = 1,column = 0, columnspan = 5)
self.canvas_keyb_num.grid(row = 2,column = 0, columnspan = 3, rowspan = 4)
self.canvas_keyb_op.grid(row = 2,column = 3, columnspan = 2, rowspan = 4)
# creation des boutons
self.b1 = Button(win, text ='1',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('1',self))
self.b2 = Button(win, text ='2',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('2',self))
self.b3 = Button(win, text ='3',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('3',self))
self.b4 = Button(win, text ='4',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('4',self))
self.b5 = Button(win, text ='5',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('5',self))
self.b6 = Button(win, text ='6',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('6',self))
self.b7 = Button(win, text ='7',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('7',self))
self.b8 = Button(win, text ='8',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('8',self))
self.b9 = Button(win, text ='9',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('9',self))
self.b_point = Button(win, text ='.',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('.',self))
self.b0 = Button(win, text ='0',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('0',self))
self.b_plus = Button(win, text ='+',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('+',self))
self.b_moins = Button(win, text ='-',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('-',self))
self.b_fois = Button(win, text ='*',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('*',self))
self.b_diviser = Button(win, text ='/',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('/',self))
self.b_del = Button(win, text ='DEL',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Del(self))
self.b_del_all = Button(win, text ='CE',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Del_all(self))
self.b_egale = Button(win, text ='=',borderwidth=0, highlightthickness=0, bg = colore,activebackground =colorf,foreground=colord,compound="c",image = pixel,height = a,width = 295 ,font = font1,command= lambda: Calcul(self))
#affichage des nombres
#colone 1
self.b7.grid(column = 0, row = 2)
self.b4.grid(column = 0, row = 3)
self.b1.grid(column = 0, row = 4)
self.b_point.grid(column = 0, row = 5)
#colone 2
self.b8.grid(column = 1, row = 2)
self.b5.grid(column = 1, row = 3)
self.b2.grid(column = 1, row = 4)
self.b0.grid(column = 1, row = 5)
#colone 3
self.b9.grid(column = 2, row = 2)
self.b6.grid(column = 2, row = 3)
self.b3.grid(column = 2, row = 4)
#operateurs
self.b_plus.grid(column = 3, row = 2)
self.b_moins.grid(column = 4, row = 2)
self.b_fois.grid(column = 3, row = 3)
self.b_diviser.grid(column = 4, row = 3)
self.b_del.grid(column = 3, row = 4)
self.b_del_all.grid(column = 4, row = 4)
self.b_egale.grid(column = 2, row = 5,columnspan = 3)
#ecriture
self.label1 = tk.Label(win, text = '', justify = tk.RIGHT,font = font2,bg =colorb,fg = colord)
self.label1.place(anchor = 'e', x = 450, y = 75)
self.b_theme = tk.Button(win, text = 'Themes',font = font3,bg =colorb,fg = colord,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 50,activebackground =colore,command= lambda: self.openmenu(colora, colorb, colorc, colord, colore, colorf))
self.b_theme.place(anchor = 'nw', x = 5, y = 2)
self.canvas_menu.bind('<1>', self.set_xy)
self.canvas_menu.bind('<B1-Motion>', self.move_window)
if theme == 0:
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
else:
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#915ec4")
win.title('calculator')
win.resizable(height=False,width=False)
win.mainloop()
最佳答案
由于您使用的是 overridedirect(True)
要删除窗口管理器装饰,正如我在评论中所说,如果您仍然需要它们的功能,您将需要提供一些方法来自己完成其中的部分或全部。您已经完成了关闭和移动窗口的操作,但您还需要做更多的工作才能使其出现在 Windows 任务栏上。
这可以通过创建一个不可见的 root
来实现。那个窗口没有 需要overridedirect(True)
应用到它,然后创建一个单独的 Toplevel
您的应用程序的窗口(并对其应用 overridedirect
)。
代码更改为执行最开始出现的所有内容。但是,您还需要对 Theme
进行一些其他小的更改。类(class)'__init__()
在这个新方案下让一切正常工作的方法(从 #creation menu
注释开始)。最后还有一些变化。
以下是您的代码,需要进行所有这些更改。注意我没有把它变成一个 .exe,所以你的里程可能会有所不同。
# -*- coding: Latin-1 -*-
import os
import math
import tkinter as tk
from tkinter import *
from tkinter import font
# Create an invisible root window.
root = tk.Tk()
root.attributes("-alpha", 0.0)
# Create a Toplevel for the application.
win = tk.Toplevel(root)
win.overrideredirect(True)
win.geometry('+400+100')
# Make root forward taskbar minimize and restore events to Toplevel instance.
root.bind("<Unmap>", lambda _: win.withdraw())
root.bind("<Map>", lambda _: win.deiconify())
font1 = font.Font(family = 'Helvetica', size = 15)
font3 = font.Font(family = 'Helvetica', size = 8, weight = 'bold')
font2 = font.Font(family = 'Helvetica', size = 20, weight = 'bold')
def aaa(colora, colorb, colorc, colord, colore, colorf):
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
Ecrire('',Light)
def aaaa(colora, colorb, colorc, colord, colore, colorf):
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#C47ED6")
Ecrire('',Dark)
def strl(list):
list ="".join(list)
return list
pixel = tk.PhotoImage(width=1, height=1)
a =95
b =95
theme = 0
t = 0
ecrit = []
nombre_de_multdiv = 0
nombre_de_sous_add = 0
def Del(self):
global ecrit
del ecrit[-1]
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Del_all(self):
global ecrit
del ecrit[:]
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Ecrire(symbole,self):
ecrit.append(symbole)
affichage = strl(ecrit)
self.label1['text'] = affichage
self.label1.place(anchor = 'e', x = 450, y = 75)
def Ecrire_Resulat(valeur,self):
valeur = strl(valeur)
self.label1['text'] = valeur
def Calcul(self):
global nombre_de_multdiv
global nombre_de_sous_add
for i in range(len(ecrit)):
if ecrit[i] == '/' or ecrit[i] == '*':
nombre_de_multdiv +=1
for i in range(len(ecrit)):
if ecrit[i] == '+' or ecrit[i] == '-':
nombre_de_sous_add +=1
for i in range(nombre_de_multdiv):
for i in range(len(ecrit)):
if ecrit[i] == '*' or ecrit[i] == '/':
numero = i
nb = i
nbb = i
for i in range(len(ecrit)-numero-1):
if ecrit[i+1 + numero] != '/' and ecrit[i+1 + numero] != '*' and ecrit[i+1 + numero] != '+' and ecrit[i+1 + numero] != '-':
nb +=1
elif ecrit[i+1+numero] == '/' or ecrit[i+1+numero] == '*' or ecrit[i+1+numero] == '+' or ecrit[i+1+numero] == '-':
break
for i in range(numero):
i = -i
if ecrit[i-1+numero] != '/' and ecrit[i-1+numero] != '*' and ecrit[i-1+numero] != '+' and ecrit[i-1+numero] != '-':
nbb -=1
elif ecrit[i-1+numero] == '/' or ecrit[i-1+numero] == '*' or ecrit[i-1+numero] == '+' or ecrit[i-1+numero] == '-':
break
nombre1 = "".join(ecrit[numero+1:nb+1])
nombre1 = float(nombre1)
nombre2 = "".join(ecrit[nbb:numero])
nombre2 = float(nombre2)
if ecrit[numero] =='*':
resultat = nombre1 * nombre2
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
else:
resultat = nombre2 / nombre1
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
del ecrit[nbb:nb+1]
for i in range(len(resultat)):
ecrit.insert(nbb+i,resultat[i])
break
for i in range(nombre_de_sous_add):
for i in range(len(ecrit)):
if ecrit[i] == '+' or ecrit[i] == '-':
numero = i
nb = i
nbb = i
for i in range(len(ecrit)-numero-1):
if ecrit[i+1 + numero] != '/' and ecrit[i+1 + numero] != '*' and ecrit[i+1 + numero] != '+' and ecrit[i+1 + numero] != '-':
nb +=1
elif ecrit[i+1+numero] == '/' or ecrit[i+1+numero] == '*' or ecrit[i+1+numero] == '+' or ecrit[i+1+numero] == '-':
break
for i in range(numero):
i = -i
if ecrit[i-1+numero] != '/' and ecrit[i-1+numero] != '*' and ecrit[i-1+numero] != '+' and ecrit[i-1+numero] != '-':
nbb -=1
elif ecrit[i-1+numero] == '/' or ecrit[i-1+numero] == '*' or ecrit[i-1+numero] == '+' or ecrit[i-1+numero] == '-':
break
nombre1 = "".join(ecrit[numero+1:nb+1])
nombre1 = float(nombre1)
nombre2 = "".join(ecrit[nbb:numero])
nombre2 = float(nombre2)
if ecrit[numero] =='+':
resultat = nombre1 + nombre2
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
else:
resultat = nombre2 - nombre1
if resultat == int(resultat):
resultat = int(resultat)
resultat = list(str(round(resultat,5)))
del ecrit[nbb:nb+1]
for i in range(len(resultat)):
ecrit.insert(nbb+i,resultat[i])
break
Ecrire_Resulat(ecrit,self)
class Theme:
def move_window(self,event):
win.geometry('+{0}+{1}'.format(event.x_root - self.x, event.y_root - self.y))
def set_xy(self,event):
self.x=event.x_root - win.winfo_x()
self.y=event.y_root - win.winfo_y()
return self.x,self.y;
def boutontheme(self,colora, colorb, colorc, colord, colore, colorf):
self.openmenu(colora, colorb, colorc, colord, colore, colorf)
if self.t == 0:
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#915ec4")
self.t = 1
Ecrire('',Light)
else:
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
self.t = 0
Ecrire('',Dark)
def openmenu(self,colora, colorb, colorc, colord, colore, colorf):
if self.ouvert == False:
self.b_theme.config(bg = colore)
if self.t == 0:
self.b_theme_dark = tk.Button(win,state=DISABLED, text = 'Dark theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_light = tk.Button(win,state=NORMAL, text = 'Light theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
else:
self.b_theme_dark = tk.Button(win,state=NORMAL, text = 'Dark theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_light = tk.Button(win,state=DISABLED, text = 'Light theme',font = font3,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 70,activebackground =colore,bg =colora,fg = colord,command = lambda: self.boutontheme(colora, colorb, colorc, colord, colore, colorf))
self.b_theme_dark.place(anchor = 'nw', x = 5, y = 25)
self.b_theme_light.place(anchor = 'nw', x = 5, y = 45)
self.ouvert = True
return;
if self.ouvert == True:
self.b_theme.config(bg = colorb)
self.b_theme_dark.destroy()
self.b_theme_light.destroy()
self.ouvert = False
return;
def __init__(self,colora, colorb, colorc, colord, colore, colorf):
if colora == '#18181F':
self.t = 0
else:
self.t = 1
self.ouvert = False
self.x = 0
self.y=0
#creation menu
self.canvas_menu = Canvas(win, width =500, height =25, bg = colora, borderwidth=0, highlightthickness=0)
# self.exit = Canvas(bg = colora,borderwidth=0, highlightthickness=0)
self.exit = Canvas(win, bg = colora,borderwidth=0, highlightthickness=0)
self.exit.create_oval(0,0,20,20, fill= colore,width = 0)
self.exit.create_text(10, 10, text="x", fill = colord, font= font3)
# self.exit.bind("<Button-1>", lambda e: win.destroy())
self.exit.bind("<Button-1>", lambda e: root.destroy())
#affichage menu
self.exit.place(anchor = 'nw', x = 475, y = 2)
self.canvas_menu.grid(row = 0,column = 0, columnspan = 5)
#creation des canvas
self.canvas_screen = Canvas(win, width =500, height =100, bg =colorb,borderwidth=0, highlightthickness=0)
self.canvas_keyb_num = Canvas(win, width =300, height =400, bg =colorb,borderwidth=0, highlightthickness=0)
self.canvas_keyb_op = Canvas(win, width =200, height =400, bg =colorb,borderwidth=0, highlightthickness=0)
#affchage des canvas
self.canvas_screen.grid(row = 1,column = 0, columnspan = 5)
self.canvas_keyb_num.grid(row = 2,column = 0, columnspan = 3, rowspan = 4)
self.canvas_keyb_op.grid(row = 2,column = 3, columnspan = 2, rowspan = 4)
# creation des boutons
self.b1 = Button(win, text ='1',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('1',self))
self.b2 = Button(win, text ='2',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('2',self))
self.b3 = Button(win, text ='3',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('3',self))
self.b4 = Button(win, text ='4',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('4',self))
self.b5 = Button(win, text ='5',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('5',self))
self.b6 = Button(win, text ='6',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('6',self))
self.b7 = Button(win, text ='7',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('7',self))
self.b8 = Button(win, text ='8',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('8',self))
self.b9 = Button(win, text ='9',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('9',self))
self.b_point = Button(win, text ='.',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('.',self))
self.b0 = Button(win, text ='0',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('0',self))
self.b_plus = Button(win, text ='+',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('+',self))
self.b_moins = Button(win, text ='-',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('-',self))
self.b_fois = Button(win, text ='*',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('*',self))
self.b_diviser = Button(win, text ='/',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Ecrire('/',self))
self.b_del = Button(win, text ='DEL',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Del(self))
self.b_del_all = Button(win, text ='CE',borderwidth=0, highlightthickness=0, bg = colora,activebackground =colorc,foreground=colord,compound="c",image = pixel,height = a,width = b ,font = font1,command=lambda: Del_all(self))
self.b_egale = Button(win, text ='=',borderwidth=0, highlightthickness=0, bg = colore,activebackground =colorf,foreground=colord,compound="c",image = pixel,height = a,width = 295 ,font = font1,command= lambda: Calcul(self))
#affichage des nombres
#colone 1
self.b7.grid(column = 0, row = 2)
self.b4.grid(column = 0, row = 3)
self.b1.grid(column = 0, row = 4)
self.b_point.grid(column = 0, row = 5)
#colone 2
self.b8.grid(column = 1, row = 2)
self.b5.grid(column = 1, row = 3)
self.b2.grid(column = 1, row = 4)
self.b0.grid(column = 1, row = 5)
#colone 3
self.b9.grid(column = 2, row = 2)
self.b6.grid(column = 2, row = 3)
self.b3.grid(column = 2, row = 4)
#operateurs
self.b_plus.grid(column = 3, row = 2)
self.b_moins.grid(column = 4, row = 2)
self.b_fois.grid(column = 3, row = 3)
self.b_diviser.grid(column = 4, row = 3)
self.b_del.grid(column = 3, row = 4)
self.b_del_all.grid(column = 4, row = 4)
self.b_egale.grid(column = 2, row = 5,columnspan = 3)
#ecriture
self.label1 = tk.Label(win, text = '', justify = tk.RIGHT,font = font2,bg =colorb,fg = colord)
self.label1.place(anchor = 'e', x = 450, y = 75)
self.b_theme = tk.Button(win, text = 'Themes',font = font3,bg =colorb,fg = colord,borderwidth=0, highlightthickness=0,compound="c",image = pixel,height = 20,width = 50,activebackground =colore,command= lambda: self.openmenu(colora, colorb, colorc, colord, colore, colorf))
self.b_theme.place(anchor = 'nw', x = 5, y = 2)
self.canvas_menu.bind('<1>', self.set_xy)
self.canvas_menu.bind('<B1-Motion>', self.move_window)
if theme == 0:
Dark = Theme('#18181F','#0C0C0F',"#505063",'#D1DDFF','#D12319',"#D1665F")
else:
Light = Theme('#F1EDF5','#D1D2E8',"#EDD5EB",'#323133','#6F2EB0',"#915ec4")
#win.title('calculator')
win.master.title('Calculator')
#win.resizable(height=False,width=False) # Not needed with overrideredirect.
win.mainloop()
关于python - 去别处后.exe消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68199714/
我使用 vanilla JS 通过 AJAX 向数据库发送请求。数据写入数据库没有问题。在刷新页面之前,我看不到被放入数据库中的内容。当我删除内容时也会发生同样的情况,我必须刷新才能看到内容消失了。
抱歉,这篇文章很长,我试图提供所有信息并解释我已经尝试过的内容。 问题: 我将经典的 Phoenix View 放入实时 View 中。虽然一切看起来都很好,但 echart 一完成绘制就消失了。好像
搜索了一下,没有找到我要找的东西。我有两个按钮,单击一次即可拉出两个不同的选择框,第二次单击它们就会消失。但是,我希望选择框 1 在单击按钮 2 时消失,反之亦然:选择框 2 将在单击按钮 1 时消失
我正在尝试使用自动布局使用“浮动”标题构建滚动视图。更确切地说,我正在尝试建立包含几列的日历视图。这些列中的每个列都应具有自己的标题,该标题应浮动在顶部,而该列可以垂直滚动到其下方。 如果一切正常,则
我正在尝试模仿星星背景。 星星是在加载时创建并随机散布在整个网站上的。到目前为止我已经调整了一些代码。 var star="•"; var numStars=100; for(var x=1;x•";
我查遍了整个网络,但找不到解决方案。我对 jQuery 也很陌生。 我的案例: 我有一个导航栏,其中的每个链接都会激活/触发一个megamenu(每个链接都有自己的megamenu)。 我需要什么:
我有一个可扩展的 ListView ,当我点击一行时,它会触发 onChildClick 或 onGroupClick,具体取决于我点击的是子项还是组。 如果我在 xml 布局文件中添加可点击的内容(
在我的程序中,我有一个 NSMutableData 变量,用于收集来自 http://www.nhara.org/scored_races-2013.htm 的信息。 .大约第三次从网站获取信息后,当
我一直在完美地使用 Genymotion,但是从最近几天开始我的 Genymotion 并打开它的 GPS 开始,我的 Genymotion 突然消失了。但是我的 eclipse 显示 Genymot
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and t
所以我的 Item::return_all() 有问题,因为我在 main.cpp 中调用它。早些时候我在 read_file() 和 for (auto data : example_item) 中
所有 UITableCells 在 UITableView 中滚动和触摸时消失。一切都以编程方式完成,我使用标准的 UITableViewCell 类。 我在某处读到包含我的单元格数据的数组可能被清空
我对 Swift 还很陌生。我的问题是我的 UICollectionView 正在消失。在 Xcode 中,它显示一切就绪,但当我在模拟器或设备上启动时,它消失了,只剩下导航栏和标签栏。 有谁知道是什
这是 this one的续题。较早的问题是在复选框上。但是后来我根据要求把check box改成了radio buttons。 现在我需要显示子单选按钮并在母单选按钮处于事件状态时更改背景颜色。一旦它
我用 JS 写了一个简单的脚本。当我将它放入 html 文档(在 body 标签的底部)时,它工作正常。当我尝试将它放入外部文档并链接它时,脚本运行但 canvas 元素消失(刚刚检查:当我将脚本放在
我正在尝试创建一个带有固定元素的滚动页面,当用户向下滚动页面时,该元素“始终”可见。例如,带有道路背景的汽车图像。因此,当用户向下滚动页面时,汽车看起来就像在路上行驶。虽然汽车出现在道路的顶部,但它必
这个问题在这里已经有了答案: How can I change CSS display none or block property using jQuery? (15 个答案) 关闭 4 年前。
我在市场上有一个支持小部件的应用程序。我对应用程序进行了一些重大更改,重新设计了很多内部结构,替换/重命名 Activity 等。其他更改包括从不同的共享首选项键获取小部件配置数据,尽管我已经编写了转
我有一个 fragment alertsfragment.java,它有一个 GridView 布局,当我打开它时,它工作正常,但是当我在其他选项卡之间滑动时,它就消失了。为了解释更多,我有一个 Ac
我是一名优秀的程序员,十分优秀!