3

Is it possible to create a frame with a fixed size, so the user can not change the size of the frame ?

wx.Frame.__init__(self, None, -1, 'Hello',wx.DefaultPosition,(400, 300))

I'm using python 2.7

thanks

3 Answers 3

5

Yes it is possible -

wx.Frame.__init__(None, -1, 'Title', style= wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
Sign up to request clarification or add additional context in comments.

5 Comments

You can see other frame styles here - zetcode.com/wxpython/firststeps/#frame
@nmnm - If you the answer useful you can upvote and accept it
@Guanidene Could you please describe exactly which of those styles actually makes the window not resizable?!?!
@Radu as far as I remember, I am just specifying wx.CLOSE_BOX, no minimize and maximise boxes. This perhaps makes it non resizable. (I don't use wxpython anymore. I have shifted to PyQt4. Would like to recommend you the same)
@Guanidene why did you switch to PyQt4 and why do you recommend it?
1

Another option is to remove the RESIZE_BORDER flag from the Frames style bitmask but keep the default frame style. You'll want to disable the maximize box too.

i.e)

style = wx.DEFAULT_FRAME_STYLE & ~wx.MAXIMIZE_BOX ^ wx.RESIZE_BORDER

Comments

0

You can also use SetSizeHints to control how big or how small you want to resize it or not resize the frame at all.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.