Re: Help with spanning widgets over multiple rows
M A <[email protected]>
| Newsgroups | gmane.comp.python.wxglade |
|---|---|
| Message-ID | <[email protected]> |
> On Jan 2, 2019, at 2:16 AM, Dietmar Schwertberger <[email protected]> wrote: > > On 02.01.2019 00:10, M A wrote: >> I installed Python 3.7.2 using brew: brew install python3. Then I installed wxpython like this: pip3 install -U wxPython. I then ran wxglade by double-clicking on the wxglade shell script. This launched wxglade but the window that opens up was blank. After a couple of tries the window started appearing normally. The about dialog for wxGlade displays this information: Version 0.9.0b2 on Python 3.7.2 and wxPython 4.0.3. > On Windows, wxGlade does also register itself as handler for .wxg files. Not sure how to implement such for Mac Os. I think this is how you do it: defaults write com.apple.LaunchServices LSHandlers -array-add \ "<dict><key>LSHandlerContentTag</key> <string>PUT_FILE_EXTENSION_HERE_WITHOUT_PERIOD</string><key>LSHandlerContentTagClass</key> <string>public.filename-extension</string><key>LSHandlerRoleAll</key> <string>org.category.program</string></dict>" This may be done thru os.system(). Found this information here: https://stackoverflow.com/questions/2969987/macosx-file-extension-associate-with-application-programmatically >> As a test I was able to span a button. The issue is the button does not expand when the wxEXPAND flag is set. It keeps the same sized shape instead. > This is probably a limitation of wx on Mac Os. It always keeps the same height, it seems. You should see the background filling the available space, though: > > On e.g. Windows the button itself will be extended: > > <jecbfhdkakcpcocm.png><clmbbjombmaileoe.png> > > > I have just noticed that weird things happen when you try to have a multi-line label on a button on Mac Os... Looks like the label can make a button span multiple rows. I agree that this is probably a bug with wxPython. A simple fix for this issue is to just add a newline character to the button's label. Example: b1 = Button(frame, ID_ANY, "Button\n") >> Also the "Pos" field in the properties window remains greyed out. > That's intentional. Enabling the re-enabling the Pos control would be a major effort with only a minor improvement in usability, I think. On revision 1.0 it would be easier to implement, but I don't think that I will do so. Ok. That is understandable. >> Since I can change the button's position using the tree view, I think being able to change it in the properties window should work also. I would also like to be able to move this button in the Design window as well. > This should work. You should be able to drag a widget from one slot to another. For copying, try with Shift or Ctrl or Command button. Cut/Copy/Paste should also work in the Design window. > Dragging may not work with all widget types, depending also on the platform. Some widgets might handle the mouse event and thus avoid a drag start. I just checked out the latest git version of wxGlade. Dragging a button from one cell to another does not work in the Design window. I also tried with a StaticText and RadioButton. >> I would change the Layout tab's Span fields to have labels "Rows:" and "Columns:". This would make things more clear as to what these fields mean. > Thanks, I will do so, either for 0.9 or 1.0. Probably I should spend a help page for the GridBagSizer as well. > Also, the row-spanning seems to get lost on saving and re-loading. This needs to be fixed. Just looked at the new labels. They look great. Thank you. I also suggest add the feature of being able to span multiple rows and columns from the Design window. When a GridBagSizer is being used, the user should be able to grab one of the resize handles (blue box) and drag to overlap other cells. Thank you.