class Trgbhtml ( TApplication ):
def __init__(self):
TApplication.__init__(self, "RGB")
self.size = (300, 120)
self.position = (200, 200)
f = ("GOST type A", 14)
self.lblR = TLabel(self, text="R = ", font=f)
self.lblR.position= (5, 5)
self.lblG = TLabel(self, text="G = ", font=f)
self.lblG.position = (5, 30)
self.lblB = TLabel(self, text="B = ", font=f)
self.lblB.position = (5, 55)
fc = ("GOST type A", 16, "bold")
self.rgbLabel = TLabel(self, text="#000000", font=fc, fg="navy")
self.rgbLabel.position = (100, 5)
self.rgbRect = TLabel(self, text="", width=150, height=60)
self.rgbRect.position = (105, 35)
self.rEdit = TEdit(self, font=f, width=50)
self.rEdit.position = (45, 5)
self.rEdit.text = "123"
self.gEdit = TEdit(self, font=f, width=50)
self.gEdit.position = (45, 30)
self.gEdit.text = "56"
self.bEdit = TEdit(self, font=f, width=50)
self.bEdit.text = "80"
self.bEdit.position = (45, 55)
self.rEdit.onChange = self.onChange
self.gEdit.onChange = self.onChange
self.bEdit.onChange = self.onChange
def onChange(self, sender):
r=int(self.rEdit.text)
g=int(self.gEdit.text)
b=int(self.bEdit.text)
s="#{:02x}{:02x}{:02x}".format(r, g, b)
self.rgbRect.background=s
self.rgbLabel.text=s
app=Trgbhtml()
app.Run()
尝试启动时指示失败 该如何解决?
错误:AttributeError:'_tkinter.tkapp'对象没有属性'root'; app = Trgbhtml(); self.lblR = TLabel(self,text =“ R =”,font = f)
答案 0 :(得分:1)
错误告诉您您使用with t as(
select row_number() over (partition by m order by d) as rn
,(row_number() over (partition by m order by d)-1) / 5 as gn
,*
from @t
where m = 1
)
select *
,case when p > r
then r + (sum(case when p < r then r else 0 end) over (partition by gn) / sum(case when p > r then 1 else 0 end) over (partition by gn))
else case when p = r
then r
else 0
end
end as r_adj
from t;
作为with t as(
select row_number() over (partition by m order by d) as rn
,(row_number() over (partition by m order by d)-1) / 10 as gn
,(row_number() over (partition by m order by d)+4) / 10 as gn2
,*
from @t
where m = 1
)
,r1 as(
select *
,case when p > r
then r + (sum(case when p < r then r - p else 0 end) over (partition by gn) / sum(case when p > r then 1. else 0. end) over (partition by gn))
else case when p = r
then r
else 0
end
end as r_adj
from t
)
select d
,m
,p
,r
,case when p > r_adj
then r_adj + (sum(case when p < r_adj then r_adj - p else 0 end) over (partition by gn2) / sum(case when p > r_adj then 1. else 0. end) over (partition by gn2))
else case when p = r_adj
then r_adj
else r_adj - (r_adj - p)
end
end as r_new
from r1
order by rn
;
的父级,但是self
不是小部件。您只能将小部件用作其他小部件的父代。