python - output changes if font is defined inside a function and if inside __init__ -
what is my doubt I got two different outputs Code which I believe is doing the same thing, I describe both cases below. What did I do I did the following And then the Output: I have changed the code code: ex> Output / P> This font is too big It thinks which of these is the actual 24 size font. Although I want the second output, why am I not getting the output with the code already used ?? Please help me with this suspicion. My guess is related to the fact that you have more than one of Case 1
__init __
self.big font is used inside that category's function:
de F quitwin (self, event = none): self.window.destroy () self.window = Tk () self.window.title ('license and credit') self.frame = frames (self.window) self.frame .pack () r = frame (self frame) r.pack () m = message (r, text = "licensed under wtfp license", font = self.big) m.pack () b = Button (r, text = 'quit', fg = 'red', bg = 'black', command = self vandu dostorey, font = self. Big) bpc (side = 'bottom') < / Pre>
Case 2
def quitwin (self, incident = none): self. Windows Dostoy () self. Windows = tc () self Window Tit ('license and credit') self.frame = frames (self.window) Self.frame.pack () r = frame (self.frame) r.pack () self.big = font (family = 'Helvetica', Size = 24) m = message (r, text = "licensed under wtfpl license", font = self.big) m.pack () b = buttons (r, text = 'quit', fg = 'red'
Doubts
Tk Examples are creating, which is not designed to use a typewriter, it may be that in the first case the font is linked to the original
Tk object, and when it is destroyed , The font gets corrupted or garbage is collected. In the second case, the same example of the font is tied in the form of a dialog with
Tk , so it is "true size 24 font".
Comments
Post a Comment