alejandroautalan / pygubu

A simple GUI builder for the python tkinter module
MIT License
2.02k stars 212 forks source link

New dialog widget #12

Closed dsl101 closed 10 years ago

dsl101 commented 10 years ago

Hi - thanks again for your advice so far - I'm getting there slowly! I moved away from the helper class based on your example, and now have a progress dialog as well as the main app window. However, there are still a couple of things not right, and some errors from the designer.

Firstly, I can't seem to set the size of the dialog window - or maybe I'm not understanding how to do it. I've tried dragging the blue box in the designer, and it snaps back to the old size as soon as I do anything else (like change a property of one of the widgets on the dialog window). If I change the height or width in the General tab of the properties pane, I see an error in the console where I ran the designer from:

WARNING:pygubu.builderobject:Attempt to set an unknown property 'modal' on class '<class pygubudesigner.widgets.toplevelframe.ToplevelFramePreview at 0x01237DF8>'

I can add padding to the widgets on the dialog to make it grow a little, but that's all.

The other thing is more tkinter I suspect, but I can't get the order of initialising / creating / showing the windows to work properly. Is there a way to get the progress dialog displayed / updated without showing the mainWindow? It appears very large (not sure why - default width of treeview columns I suspect, which aren't set until the data is loaded and I know what width they need to be). It's also just an empty white box until the data is loaded...

Thanks again for your help and effort on pygubu - there's no way I'd have got this far without both!

alejandroautalan commented 10 years ago

Hello :)

Firstly, I can't seem to set the size of the dialog window - or maybe I'm not understanding how to do it. I've tried dragging the blue box in the designer, and it snaps back to the old size as soon as I do anything else (like change a property of one of the widgets on the dialog window).

The Dialog widget is created using a Toplevel. So, to set a default size to the dialog you can use the 'geometry' property. Example, enter 400x300, in the property editor, to set the dialog size to 400x300 pixels. Check http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/geometry.html for more info. Dragging the blue box in the preview panel will not change the widget properties, it is used to test the gridding layout and see how the internal widgets contract and expand.

If I change the height or width in the General tab of the properties pane, I see an error in the console where I ran the designer from:
WARNING:pygubu.builderobject:Attempt to set an unknown property 'modal' on class ''

This was just a waring and I fixed in the last commit. Sorry if I confused with that. It was because i can not embed Toplevels on the canvas, so I need to use 'preview' widgets.

The other thing is more tkinter I suspect, but I can't get the order of initialising / creating / showing the windows to work properly. Is there a way to get the progress dialog displayed / updated without showing the mainWindow? It appears very large (not sure why - default width of treeview columns I suspect, which aren't set until the data is loaded and I know what width they need to be). It's also just an empty white box until the data is loaded...

You can use the toplevel methods 'withdraw' and 'deiconify' of your main window. After mainwindow creation you call 'mainwindow.withdraw()' to hide the window. And after the Dialog window is closed you show the main window again with 'mainwindow.deiconify()' Here is the example I showed you in the other issue. Modified to do that. http://linkode.org/0zyH5TKqNtqDgKYbzSrB9