tkinter - python 3.2.5 grid sticky/weight not working -


Below is a simple example of the problem: it has a grid layout in which I have a button in the line 0 A text widget is placed in the widget and row 1 .

I want the text widget in the line 1 for text widget, keeping the NW (not row 0 extension) keeping the text above the widget and expanding it with the form for. The problem is that the horizontal column (the column is spread correctly, but the text is not the widget line), if I get rid of the button, the text widget spreads correctly. Also, whatever I have originally kept, it is more involved and the best used grid is. So basically the pack is not a solution to use. Any help would be appreciated.

  ###################################### Tanker Import * From class app (frame): def __init __ (self, parent): frame .__ init __ (self, parent) self.parent = parents themselves Integuei () ############################################# ################# # Initiate GUI Widgets InitGui (Self): self.parent.title ("Test Grid") Self.pgr.Resizable (width = true, height = TRUE) self.grid (sticky = W + E + N + S, padx = 20, pady = 20) self.parent.columnconfigure (0, weight = 1) auto Selfconfigure (1, weight = 1) self.rowconfigure (1, weight = 1) # Add a button to the line 0 self.btn = button (auto, text = "button", width = 20) BTN Grid (line = 0, c thin = 0, padx = (0,10), pdi = (0,10), sticky = = + w) # Add 1 text box and v-scroll bar to a line self.txtOut = Text (self, width = 80, height = 20) self.scrOut = scrollbar (self) self.txtOut.grid (line = 1, column = 0, padx = (0,18), sticky = n + e + s + w ) self.scrOut.grid (line = 1, column = 0, stick = = N + e) ​​self.scrOut.config (command = self.txtOut.yview) self.txtOut.config (yscrollcommand = self.scrOut.set) Print (self.grid_size ()) Def main (): Root = TC () App = App (root = root) app. Menloof () if __name__ == '__main__': main ()    

Such a case Where using the pack is probably a solution if you pack an example of the frame ( Application ) inside the root window, then there will be no reason for any collision, then Grid widget inside that frame It will configure all the lines and cuts on the headache of the configured configurations and will be more sensible for me. Def initGui (self): self.parent.title ("Test Grid") Self.pol.resizable (width = true, height = TRUE) self.pack (fill = both, expand = 1, padx = 20, pady = 20) self.columnconfigure (0, weight = 1) self.rowconfigure (1, weight = 1)

Comments

Popular posts from this blog

jasper reports - How to center align barcode using jasperreports and barcode4j -

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -