Re: find difference in days from YYYYMMDD to YYYYMMDD

2007-09-22 Thread chaelon
On Sep 22, 5:37 am, Konstantinos Pachopoulos <[EMAIL PROTECTED]>
wrote:
> Hi,
> does any body now any such algorith? to find difference in days from
> MMDD to MMDD?
> Or just an algorithm, that converts MMDD to seconds since the epoch?
>
> Thanks

Seen some complex answers here.  Let's keep it dead simple.  Use the
datetime module to do the heavy lifting.  Go to IDLE, write this.

import datetime.

Then start to write this:

difference = datetime.date(

and at that point IDLE will tell you to put in year,month,day.  That's
convenient.  Do as IDLE asks, obey IDLE!  Wind up with this (put date
later in history first, here are two I've used):

difference = datetime.date(2007,9,25) - datetime.date(1970,12,25)
print difference

13419 days, 0:00:00

Hey now!  Date math!  Yeah!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sizers in wxpanels/notebooks

2007-12-07 Thread chaelon
On Dec 7, 9:52 pm, Astan Chee <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a wxNoteBook with a bunch of wxPanels attached to it as pages.
> Every page has its own GUI items.
> What Im trying to do is on a certain page, a certain GUI (wxTextCtrl) to
> be resized every time the notebook or panel is resized. But everything
> else stays the same.
> Now I know I can use sizers to solve this, but I have each GUI item's
> position hard-coded and they shouldnt move around or change size. I was
> thinking of putting this wxTextCtrl in a child wxPanel of these
> wxPanel/pages. So the hierarchy is wxNoteBook -> wxPanel -> wxPanel ->
> wxSizer.Add( wxTextCtrl)
> is this possible? how do i get it working? are there other alternatives
> to what Im trying to do? because simply putting a wxPanel in a wxPanel
> and adding a sizer in a normal manner doesnt work for me.
> below is a snippet of what Im doing (i dont want the button to change
> position or change size or be in any sizers, but I do want the textctrl
> to do so).
>
> self.tab12 = wxPanel(self.notebook,-1)
> self.s_test = wxButton(self.tab12,-1,"Clear",(20,20))
> self.tab12_child = wxPanel(self.tab12,-1,(0,0),self.tab12.GetSize())
> self.c_test =
> wxTextCtrl(self.tab12_child,-1,"",(130,270),wxSize(800,350),style=wxTE_MULTILINE|wxHSCROLL|wxTE_RICH2|wxTE_RICH)
> self.globalSizer = wx.BoxSizer(wxHORIZONTAL)
> self.globalSizer.Add(self.c_test)
> self.tab12.SetSizer(self.globalSizer)
> self.globalSizer.SetSizeHints(self)
>
> self.notebook.AddPage(self.tab12,"Test Sizers")
>
> Thanks!
> Astan

I don't get the need for self.tab12_child...You can just add the
textctrl to
a notebook directly, it will automatically fill the whole notebook
page
and resize as the notebook resizes.  If instead you don't want it
taking
up the whole area of the notebook page, you'd put a self.tab12 as the
page,
then set the sizer on that panel, then add the notebook to that sizer.
Don't
know where the button is supposed to go. Beyond this, it is difficult
to
say what you should do as it is hard to picture this precisely from
your
description.

I recommend you post wxPython questions to the wxPython list, which
you can find a link for signing up to at the wxPython site,
www.wxpython.org
-- 
http://mail.python.org/mailman/listinfo/python-list