fix size of a frame

how do i fix the size of a frame?another ques i wish to use two or more panels in one frame,all of which operate on same data.How can that be done?

nipun batra wrote:

how do i fix the size of a frame?

What about frame.SetSize.

Are you sure you want to fix the size, do you not just want a size which is enough for the containing controls and then let the user size it to his liking?

so, maybe frame.Fit or uses sizers and use frame.Layout or ....

another ques i wish to use two or more panels in one frame,all of which operate on same data.How can that be done?

You could use pubsub and have all controls on your panels react to whatever message you send using pubsub.

Werner

Can someone please provide simple examples.Didnt understand much from the wiki.

Hi,

nipun batra wrote:

Can someone please provide simple examples.Didnt understand much from the wiki.

You have a better chance of getting a sample if you put one up and state what is not working to your liking.

Werner

Ok i have attached three files.All these 3 are working on the same data being read from file/serial port.I wish all three to be updated every timer cycle and also to have these 3 in separate panels.Will be grateful if someone helps.

Chris+Nipun.py (2.15 KB)

Transform_final.py (3.8 KB)

display_update._read_imu.py (1.45 KB)

Werner probably meant a "small runnable sample", a key concept in the
wxPython list. What you have posted is your actual code, not a SRS.
(It's not ready to run because it refers to a .txt file only you have, e.g.)
But you can learn all about the values of one and how to post one here:

http://wiki.wxpython.org/MakingSampleApps

Note in that document it says: "Just to be clear, the sample app you send
to the list should not be a copy of the app you are having trouble with. Nobody
wants to read through all the rest of the code of your app just to
figure out one
little problem with one widget 15 clicks away from the startup."

It's a valuable self-teaching tool, and a great way to get help here,
so give this
approach a try.

Che

···

On Sun, Sep 27, 2009 at 4:10 AM, nipun batra <nipunreddevil@gmail.com> wrote:

Ok i have attached three files.All these 3 are working on the same data
being read from file/serial port.I wish all three to be updated every timer
cycle and also to have these 3 in separate panels.Will be grateful if
someone helps.

Thats why i asked if someone knew about some example with whose help i shall learn without disturbing the list

By the way almost all three files have same code wrt to obtaining data and remaining stuff is what shall not require a thorough reading.

Thats why i asked if someone knew about some example with whose help i shall
learn without disturbing the list

You asked others to "provide" examples. And asking questions is certainly
not a disturbance to the list. It is just there are more or less efficient ways
to go about it.

So, Some example of which things, specifically? If you could specify,
or indicate
where you are stuck, it would help people to help you.

It's clear you are just not grokking the philosophy of making small
runnable samples.

···

On Sun, Sep 27, 2009 at 11:19 AM, nipun batra <nipunreddevil@gmail.com> wrote:

By the way almost all three files have same code wrt to obtaining data and
remaining stuff is what shall not require a thorough reading.

Examples of how to make multiple panels in a frame,which operate on same data and produce results which are updated in all panels after timer pulse

Hmm, I doubt there are any examples just out there online that capture all
that in one shot. Let's break your points down one by one with some
clarifying questions...

Do you know how to make multiple panels on a frame?

When you say that the panel operates on data, I'm assuming you just want
the data passed to the panel class somehow, correct? Then some method
within that panel class will use that data to update widgets on the panel,
correct?

Have you tried to use wxTimer yet?

···

On Sun, Sep 27, 2009 at 11:42 AM, nipun batra <nipunreddevil@gmail.com> wrote:

Examples of how to make multiple panels in a frame,which operate on same
data and produce results which are updated in all panels after timer pulse

All my programs are using timer.So first question is most important.How to lay multiple widgets
Then in some main class(as i used to say in c++) i acquire data and then pass this data to widgets every clock cycle

nipun batra wrote:

All my programs are using timer.So first question is most important.How to lay multiple widgets

http://wiki.wxpython.org/UsingSizers

Then in some main class(as i used to say in c++) i acquire data and then pass this data to widgets every clock cycle

http://wiki.wxpython.org/Data-aware%20Controls%20with%20Validators%2C%20demonstrated%20in%20a%20dialog

The most productive way of helping you would still be you doing an application which is stand alone and can run on anyones machine (see CM's message), start with part of what you want to end up and when you hit a road block post your code and explain what is blocking you from proceeding.

Depending how large your total application will become you should probably also look at pubsub. I allows you to have communication/messages between your different parts of the application without any part needing to know anything about the other parts.

http://wiki.wxpython.org/Controlling%20GUI%20with%20pubsub

Werner

All my programs are using timer.So first question is most important.How to
lay multiple widgets

There are a lot of tutorials out there, many on the wxPywiki page, and you just
have to slog through them slowly and get the sense for how to write wxPython
code. That said, I have attached a small sample of just a few widgets laid out
on a page using sizers, if it is helpful (this took 2 minutes to do with Boa
Constructor). If there are any questions about it, let me know. Sizers are
notoriously somewhat difficult to understand at first, but well worth using.

Then in some main class(as i used to say in c++) i acquire data and then
pass this data to widgets every clock cycle

Every clock cycle? I think you mean every time your timer goes off,
right? :smiley:

As Werner said, pubsub is great for passing data. You basically set up
a "listener" function that subscribes to the "broadcast" of your pubsub
class, and every time that pubsub class broadcasts the data, the listener
(or multiple listeners) will get it. There are other ways to do it,
too, though.

Che

testFrame.py (2.12 KB)

···

On Sun, Sep 27, 2009 at 12:00 PM, nipun batra <nipunreddevil@gmail.com> wrote:

I saw the wiki page on sizers and found it apt for my work.However using the example they had given using 2 panels with different backgrounds,I am not able to get the output on any of the panels.Though i am able to put static texts in both.This time i wont ask for the exact code.
Suppose we have a mouse event.In panel1 i want to display the x position of mouse and in panel2 the y position
Or show timer value consistently updated in the two panels

Eventually i will be using timer to update my panels

sizer_help.py (654 Bytes)

nipun batra wrote:

This time i wont ask for the exact code.

Then what are you asking? It's best to have a specific question. Ideally, you post a simple, self contained example that is as close as you can get, and ask about what isn't working the way you expect.

Suppose we have a mouse event.In panel1 i want to display the x position of mouse and in panel2 the y position

How about the enclosed?

> How can i make an

application handling some data which i send to multiple panels

You have two basic choices:
   1) keep references to you various panels so you can call their methods to update them -- this is what I did above, for a very simple case.

   2) use a messaging system -- wx.lib.pubsub is a good choice, and quite easy to use.

You might want to read up on "MVC" and/or "MVP":

http://wiki.wxpython.org/AdvancedDesign

( and many other references on the web)

-Chris

sizer_help.py (1.02 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Thanks Chris
But when i executed the program the text label was not changing.I was looking this sort of a program only.So,how do i get the label changing

Hi,

Thanks Chris
But when i executed the program the text label was not changing.

It works here - the text labels update with the X and Y position when
the mouse pointer is moved in the upper/blue box. The labels do not
update when the pointer is moved in the lower/red box or outside the
frame.

I was
looking this sort of a program only.So,how do i get the label changing

Try again maybe?

I'm using Python 2.5.x and wxPython 2.8.x on Win32.

HTH.

Cheers,
Scott.

···

On Sat, Oct 3, 2009 at 4:17 AM, nipun batra <nipunreddevil@gmail.com> wrote:

Thanks all i got a similar program up and running where i used textctrl and the simplicity was amazing.wxPython rocks!