Style of frame

Dear All,

I’m trying to find out what style must I define to only have a title and a close box in a frame.

I tried the following 4 styles

import wx

myApp = wx.App()

myf1 = wx.Frame(None, -1, ‘1er cadre’, style = wx.CAPTION | wx.CLOSE_BOX)

myf1.Show()

myf2 = wx.Frame(None, -1, ‘2nd cadre’, style = wx.FRAME_TOOL_WINDOW | wx.CAPTION | wx.SYSTEM_MENU)

myf2.Show()

myf3 = wx.Frame(None, -1, ‘3ième cadre’, style = wx.CAPTION | wx.SYSTEM_MENU)

myf3.Show()

myf4 = wx.Frame(None, -1, ‘4ième cadre’, style = wx.FRAME_TOOL_WINDOW | wx.CAPTION | wx.CLOSE_BOX)

myf4.Show()

and I get the attached 4 frames. The two frames on the right have - of course - a narrower caption bar (or title bar) because of the wx.FRAME_TOOL_WINDOW style, which is expected. What I try to obtain is a frame that looks like the second frame but with a normal (wider) blue band. I understnad that it is necessary to select the wx.CAPTION style otherwise the top blue band is not present and you can’t even have a title written in such case.

I expected my first frame drawn as myf1 (upper left) to give me that but as you can see, there is no CLOSE_BOX drawn !?

This is WinXP SP3, Python 2.5.4, wxPython 2.8.9.2. When trying on my Linux box, I have all sorts of other frame styles but I never get the one I want.

Thank you in advance,

Regards, Rene

PS: I referred to pages 228-229 of wxPython In Action. Could not figure out the solution. myf2 is the example shown in figure 8.3 on page 228

Dear All,

I'm trying to find out what style must I define to only have a title and a
close box in a frame.

...

Thank you in advance,
Regards, Rene
PS: I referred to pages 228-229 of wxPython In Action. Could not figure out
the solution. myf2 is the example shown in figure 8.3 on page 228
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi Rene,
does
myf1 = wx.Frame(okno, -1, '1er cadre', style = wx.SYSTEM_MENU

wx.CAPTION | wx.CLOSE_BOX)

create the frame style you need?
I'm not quite sure, how the SYSTEM_MENU is connected with the other
styles, I just experimented with the default frame style -
wxDEFAULT_FRAME_STYLE gradually removing some styles.
cf. wxFrame

hth
vbr

···

2009/4/16 Rene Heymans <rene.heymans@gmail.com>:

Dear Vlastimil,

Thank you for your experiment. Alas it is not the solution. The wx.SYSTEM_MENU is still present on the left corner of the title bar !

If you refer to

http://msdn.microsoft.com/en-us/library/ms632597(VS.85).aspx

you will see that Microsoft calls this the “Application Icon”. When you right-click on it, you have the usual menu (restore, minimize, maximize, move, close, …), hence I guess the name “System Menu”.

I have tried to find the answer by looking in the code, but I’m too new to the subject matter to understand something. There are 2 files: _windows.py and windows.pyd dealing with this. Within the _windows.py, if you search for CLOSE_BOX, you find a line of code refering to a CLOSE_BOX in windows. Unfortunately, the windows.pyd is a DLL and can’t be read as a .py file. I looked at the source code on the wxpython.org website. My understanding is that the DLL is compiled from the windows.wrap.cpp found in

http://svn.wxwidgets.org/viewvc/wx/wxPython/trunk/src/msw/

which itself is generated from … ? I don’t know … I’m lost here. I thought it might come from the windows.cpp file in the wxWidgets files but there is no trace of CLOSE_BOX in that file. So, I can’t investigate further …

Strangely enough, I looked at the window styles available in the WinAPI of Microsoft and I find the following ones which are very similar in purpose and intend to our wx.STYLES

WS_BORDER

Creates a window that has a thin-line border.
WS_CAPTION

Creates a window that has a title bar (includes the WS_BORDER style).
WS_SYSMENU
Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.

but … how come !? … there is no WS_CLOSEBOX !!! There is well a WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I’m perplexed.

Well, my concluding hypothesis are the following:

  1. There is no WS_CLOSEBOX defined within WinAPI, meaning that for Micorsoft a SYSTEM_MENU includes as a bare minimum a close function that is automatically duplicated in a close icon (the X in the upper right corner). Indeed, if one specifies only:

" style = wx.CAPTION | wx.SYSTEM_MENU "

then the menu box appears on the left side (but the close choice is greyed) and the X icon appears in the right corner but is greyed (or dimmed) making the close function unavailable.

  1. The wx.CLOSE_BOX doesn’t draw an X icon in the upper right corner but probably enables the close function, to which MS responds by making the icon active (bright instead of dimm) and rending the close choice readable (black instead of grey) in the system menu.

  2. The wx.CLOSE_BOX argument is thus very different by its role from the wx.MINIMIZE_BOX and wx.MAXIMIZE_BOX, which themselves are real orders to draw the corresponding icons in an enabled fashion, both requiring the wx.SYSTEM_MENU style too.

For a definitive opinion, one needs more clarification from experts.

Good evening,

Rene

PS: If you are curious, you can decompose wx.DEFAULT_FRAME_STYLE (=541,072,960) into its constituent bits wx.CAPTION (bit 29), wx.CLIP_CHILDREN (bit 22), wx.CLOSE_BOX (bit 12), wx.SYSTEM_MENU (bit 11), wx.MINIMIZE_BOX (bit 10), wx.MAXIMIZE_BOX (bit 9), wx.RESIZE_BORDER (bit 6). This info is useless (e.g. print wx.CLOSE_BOX gives 4096) except that you can find if a mask or flag is either a single bit (a power of 2) or a combination of bits.

···

On Thu, Apr 16, 2009 at 8:55 PM, Vlastimil Brom vlastimil.brom@gmail.com wrote:

2009/4/16 Rene Heymans rene.heymans@gmail.com:

Dear All,

I’m trying to find out what style must I define to only have a title and a
close box in a frame.

Thank you in advance,
Regards, Rene
PS: I referred to pages 228-229 of wxPython In Action. Could not figure out
the solution. myf2 is the example shown in figure 8.3 on page 228


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi Rene,
does
myf1 = wx.Frame(okno, -1, ‘1er cadre’, style = wx.SYSTEM_MENU

wx.CAPTION | wx.CLOSE_BOX)

create the frame style you need?
I’m not quite sure, how the SYSTEM_MENU is connected with the other
styles, I just experimented with the default frame style -
wxDEFAULT_FRAME_STYLE gradually removing some styles.

cf. http://docs.wxwidgets.org/2.8.0/wx_wxframe.html

hth
vbr


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Rene Heymans wrote:

Thank you for your experiment. Alas it is not the solution. The
wx.SYSTEM_MENU is still present on the left corner of the title bar !
...
Strangely enough, I looked at the window styles available in the
WinAPI of Microsoft and I find the following ones which are very
similar in purpose and intend to our wx.STYLES

WS_BORDER
                           Creates a window that has a thin-line border.
WS_CAPTION
                           Creates a window that has a title bar
(includes the WS_BORDER style).
WS_SYSMENU
                           Creates a window that has a window menu on
its title bar. The WS_CAPTION style must also be specified.

but ... how come !? ... there is no WS_CLOSEBOX !!! There is well a
WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I'm perplexed.

The "close" box is a system command. It is essentially considered an
extension of the system menu. If you include the system menu, then you
get the close box. If you exclude the system menu, you exclude the
close box. That's just the way the Windows API was designed. You
cannot have a title without a close box, unless you draw the close box
yourself.

You can always grab the system menu and delete anything you don't want
people to pick.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

You are right, I missed, that the system menu also should be removed.
Just another idea, you might check wx.Dialog instead of the Frame, simply:

my_dlg = wx.Dialog(None, -1, 'my dialog')
my_dlg.Show()

looks maybe similar to what you want, but I am not sure, what the
drawbacks of this approach might be...
  vbr

···

2009/4/17 Rene Heymans <rene.heymans@gmail.com>:

The wx.SYSTEM_MENU is still present on the left corner of the title bar !

Dear Tim,

Thank you for this precision. It fits with my understanding.

Regards, Rene

···

On Fri, Apr 17, 2009 at 12:22 AM, Tim Roberts timr@probo.com wrote:

Rene Heymans wrote:

Thank you for your experiment. Alas it is not the solution. The
wx.SYSTEM_MENU is still present on the left corner of the title bar !


Strangely enough, I looked at the window styles available in the
WinAPI of Microsoft and I find the following ones which are very
similar in purpose and intend to our wx.STYLES

WS_BORDER
Creates a window that has a thin-line border.
WS_CAPTION
Creates a window that has a title bar
(includes the WS_BORDER style).

WS_SYSMENU
Creates a window that has a window menu on
its title bar. The WS_CAPTION style must also be specified.

but … how come !? … there is no WS_CLOSEBOX !!! There is well a

WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I’m perplexed.

The “close” box is a system command. It is essentially considered an
extension of the system menu. If you include the system menu, then you

get the close box. If you exclude the system menu, you exclude the
close box. That’s just the way the Windows API was designed. You
cannot have a title without a close box, unless you draw the close box
yourself.

You can always grab the system menu and delete anything you don’t want
people to pick.


Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Dear Vlastimil,

Thank you for your suggestion. Indeed it provides the look I was searching for but it is typical to a wx.Dialog and I don’t think that wx.Frame and wx.Dialog are almost interchangeable.

The difference between wx.DEFAULT_FRAME_STYLE and wx.DEFAULT_DIALOG_STYLE are the wx.CLIP_CHILDREN, wx.MINIMIZE_BOX, wx.MAXIMIZE_BOX and wx.RESIZE_BORDER, which makes sense.

Both wx.Frame and wx.Dialog derive from the same class (wx.TopLevelWindow) and even if I can guess some differences between the 2 classes I can’t tell in what way exactly they differ. For instance, I can’t name an operation that is possible in a frame that can’t take place within a dialog or vice-versa. I suppose that this is linked to the fact that MS makes a stronger distinction between “Dialog Boxes” and “Windows”. So I guess it is wrong to simply assume that a wx.Dialog is a wx.Frame with less or simpler possibilities. There must be some fundamental differences, which I haven’t yet grasped.

Anyway, from Tim’s answer, it is clear that the WinAPI is such that one CANNOT have a frame with just a title and a close icon. This is a style only possible with a dialog.

Regards, Rene

···

On Fri, Apr 17, 2009 at 12:32 AM, Vlastimil Brom vlastimil.brom@gmail.com wrote:

2009/4/17 Rene Heymans rene.heymans@gmail.com:

The wx.SYSTEM_MENU is still present on the left corner of the title bar !

You are right, I missed, that the system menu also should be removed.
Just another idea, you might check wx.Dialog instead of the Frame, simply:

my_dlg = wx.Dialog(None, -1, ‘my dialog’)
my_dlg.Show()

looks maybe similar to what you want, but I am not sure, what the
drawbacks of this approach might be…

vbr


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Tim Roberts wrote:

Rene Heymans wrote:

Thank you for your experiment. Alas it is not the solution. The
wx.SYSTEM_MENU is still present on the left corner of the title bar !
...
Strangely enough, I looked at the window styles available in the
WinAPI of Microsoft and I find the following ones which are very
similar in purpose and intend to our wx.STYLES
WS_BORDER
                           Creates a window that has a thin-line border.
WS_CAPTION
                           Creates a window that has a title bar
(includes the WS_BORDER style).
WS_SYSMENU Creates a window that has a window menu on
its title bar. The WS_CAPTION style must also be specified.

but ... how come !? ... there is no WS_CLOSEBOX !!! There is well a
WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I'm perplexed.

The "close" box is a system command. It is essentially considered an
extension of the system menu. If you include the system menu, then you
get the close box. If you exclude the system menu, you exclude the
close box. That's just the way the Windows API was designed. You
cannot have a title without a close box, unless you draw the close box
yourself.

In fact the wxCLOSE_BOX style is implemented by enabling/disabling the Close menu item in the system menu and Windows takes care of the rest. So without a system menu there is no close

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thank you Robin.

This clarifies the matter for me.

Good day, Rene

···

On Fri, Apr 17, 2009 at 7:50 AM, Robin Dunn robin@alldunn.com wrote:

Tim Roberts wrote:

Rene Heymans wrote:

Thank you for your experiment. Alas it is not the solution. The
wx.SYSTEM_MENU is still present on the left corner of the title bar !


Strangely enough, I looked at the window styles available in the
WinAPI of Microsoft and I find the following ones which are very
similar in purpose and intend to our wx.STYLES
WS_BORDER
Creates a window that has a thin-line border.

WS_CAPTION
Creates a window that has a title bar
(includes the WS_BORDER style).
WS_SYSMENU Creates a window that has a window menu on
its title bar. The WS_CAPTION style must also be specified.

but … how come !? … there is no WS_CLOSEBOX !!! There is well a
WS_MINIMIZEBOX and WS_MAXIMIZEBOX but NO WS_CLOSEBOX !!! I’m perplexed.

The “close” box is a system command. It is essentially considered an

extension of the system menu. If you include the system menu, then you
get the close box. If you exclude the system menu, you exclude the
close box. That’s just the way the Windows API was designed. You
cannot have a title without a close box, unless you draw the close box

yourself.

In fact the wxCLOSE_BOX style is implemented by enabling/disabling the Close menu item in the system menu and Windows takes care of the rest. So without a system menu there is no close


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!


wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I’m a noob to Python and wxPython so
forgive me my input is mis-guided, however, I’ve recently converted a
frame to a dialog. With the exception of the CreateStatusBar method which
apparently is only available on a frame, everything else I had worked fine
albeit the app is not overly complicated.

···

From:
wxpython-users-bounces@lists.wxwidgets.org
[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of Rene Heymans
Sent: Thursday, April 16, 2009
6:38 PM
To:
wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users]
Style of frame

Dear Vlastimil,

Thank you for your suggestion. Indeed it provides the look I was
searching for but it is typical to a wx.Dialog and I don’t think that wx.Frame
and wx.Dialog are almost interchangeable.

The difference between wx.DEFAULT_FRAME_STYLE and
wx.DEFAULT_DIALOG_STYLE are the wx.CLIP_CHILDREN, wx.MINIMIZE_BOX,
wx.MAXIMIZE_BOX and wx.RESIZE_BORDER, which makes sense.

Both wx.Frame and wx.Dialog derive from the same class
(wx.TopLevelWindow) and even if I can guess some differences between the 2
classes I can’t tell in what way exactly they differ. For instance, I can’t
name an operation that is possible in a frame that can’t take place within a
dialog or vice-versa. I suppose that this is linked to the fact that
MS makes a stronger distinction between “Dialog Boxes” and
“Windows”. So I guess it is wrong to simply assume that a wx.Dialog
is a wx.Frame with less or simpler possibilities. There must be some
fundamental differences, which I haven’t yet grasped.

Anyway, from Tim’s answer, it is clear that the WinAPI is such that one
CANNOT have a frame with just a title and a close icon. This is a style only
possible with a dialog.

Regards, Rene

On Fri, Apr 17, 2009 at 12:32 AM, Vlastimil Brom vlastimil.brom@gmail.com wrote:

2009/4/17 Rene Heymans rene.heymans@gmail.com:

The wx.SYSTEM_MENU is still present on the left corner of
the title bar !

You are right, I missed, that the system menu also should be removed.

Just another idea, you might check wx.Dialog instead of the Frame, simply:

my_dlg = wx.Dialog(None, -1, ‘my dialog’)

my_dlg.Show()

looks maybe similar to what you want, but I am not sure, what the

drawbacks of this approach might be…

vbr


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi,

I need to get date+time data from my user.
Is there a wxPython widget that will guide my user in entering in the right format ?

For instance, I want the data to be entered like so: ‘2008.08.22 13:29:57’ (see code below).

I could think of several ways to “force” my user to not make entry mistakes, but - it may be that this problem was solved already, and a widget for date+time entry already exist.

Do you know of such a widget ?

Thanks,

Ron.

epoch = os.stat(file_path)[ST_MTIME]
return(time.strftime("%Y.%m.%d %H:%M:%S",time.localtime(epoch)))

Hi Ron,

Barak, Ron wrote:

Hi,
I need to get date+time data from my user.
Is there a wxPython widget that will guide my user in entering in the right format ?
For instance, I want the data to be entered like so: '2008.08.22 13:29:57' (see code below).
I could think of several ways to "force" my user to not make entry mistakes, but - it may be that this problem was solved already, and a widget for date+time entry already exist.
Do you know of such a widget ?

You could use the wx.lib.masked control or what about the DatePicker control, also not sure if that allows for the time portion.

I initially used the masked control, but recently switched to DatePicker as it offers a nice calendar drop down. Which means the user is not forced to type in the date, but can pick it on the calendar.

Werner

P.S.
Check out the wxPython demo for both of these controls.

···

Thanks,
Ron.
epoch = os.stat(file_path)[ST_MTIME]
return(time.strftime("%Y.%m.%d %H:%M:%S",time.localtime(epoch)))
------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi Werner,
Thanks for the tip on DatePicker. That widget solves nicely the Date entry problem.
I still needed the time entry part, so went searching in the Demos, expecting to find a TimePicker (:wink:
but instead found TimeCtrl.
So, seems I have all the building-blocks I need to solve my date+time entry problem.
Many thanks,
Ron.

···

-----Original Message-----
From: Werner F. Bruhin [mailto:werner.bruhin@free.fr]
Sent: Thursday, May 07, 2009 15:56
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] wxPython widget for date+time entry ?

Hi Ron,

Barak, Ron wrote:
> Hi,
>
> I need to get date+time data from my user.
> Is there a wxPython widget that will guide my user in
entering in the
> right format ?
>
> For instance, I want the data to be entered like so: '2008.08.22
> 13:29:57' (see code below).
> I could think of several ways to "force" my user to not make entry
> mistakes, but - it may be that this problem was solved
already, and a
> widget for date+time entry already exist.
>
> Do you know of such a widget ?
You could use the wx.lib.masked control or what about the
DatePicker control, also not sure if that allows for the time portion.

I initially used the masked control, but recently switched to
DatePicker as it offers a nice calendar drop down. Which
means the user is not forced to type in the date, but can
pick it on the calendar.

Werner

P.S.
Check out the wxPython demo for both of these controls.
>
> Thanks,
> Ron.
>
> epoch = os.stat(file_path)[ST_MTIME]
> return(time.strftime("%Y.%m.%d %H:%M:%S",time.localtime(epoch)))
>
----------------------------------------------------------------------
> --
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users@lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
>

Searching the demo and learning from its examples is such a good idea.
It's a great resource for wxPythonistas.

Che

···

On Mon, May 11, 2009 at 2:11 AM, Barak, Ron <Ron.Barak@lsi.com> wrote:

Hi Werner,
Thanks for the tip on DatePicker. That widget solves nicely the Date entry problem.
I still needed the time entry part, so went searching in the Demos, expecting to find a TimePicker (:wink:
but instead found TimeCtrl.
So, seems I have all the building-blocks I need to solve my date+time entry problem.
Many thanks,
Ron.