Re: sorting question

2008-03-13 Thread "Andrew Rekdal"
Seems 'KEYBOARDS' works nicely

-- 
-- Andrew

"jcnbp8k" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> Hi Patty,
>
> That's easy solved, the word is keyboards.
>
> I just did a google search for 'anagram solver' and got lucky with Andy's
> free online anagram solver at http://www.ssynth.co.uk/~gay/anagram.html
> :)
>
> I know it's not a python script, though are you actually working on a 
> python
> program to de-scramble words yourself or did you just want the answer?
>
> Hope that helps.
>
> Cheers,
>
> Joe
> http://www.neosource.com.au www.neosource.com.au  - Practical Software
> Solutions
>
>
> Patty Sutcliffe wrote:
>>
>> The website you list regarding 9-letter scrambled words doesn't exist any
>> longer.  Is there another way that I can access it to see your program 
>> you
>> designed?  I have a nine letter work I need to unscramble.  I will send 
>> it
>> just in case you can figure it out for me and let me know.
>>
>> KAEOSYBRD
>>
>> I'm not very good at that sort of thing, but would love to know the 
>> answer
>> to this one.
>>
>> Thank you,
>> Patty
>> [EMAIL PROTECTED]
>>
>>
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list
>>
>
> -- 
> View this message in context: 
> http://www.nabble.com/sorting-question-tp16041301p16043041.html
> Sent from the Python - python-list mailing list archive at Nabble.com.
> 


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


Re: Python regex

2008-03-13 Thread &quot;Andrew Rekdal"


-- 
-- Andrew

"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
On Mar 13, 8:03 pm, "Andrew Rekdal" <@comcast.net> wrote:
> I hope posting is ok here for this question...
>
> I am attempting to extract the text from a CSS comment using 're' such 
> as...
>
> string = "/* CSS comment /*"
> exp = "[^(/*)].*[^(*/)] "
>
> p = re.compile(exp)
> q = p.search(string)
> r = q.group()
>
> print r
>
> >>CSS comment
>
> although this works to a degree... I know the within the brackets 
> everything
> is taken literally so the pattern
> I am to negating is "(/*)". ie. includes the parenthesis.
>
> So my question is...
>
> Is there a way to negate a pattern that is more than on character long? 
> eg.
> where rather than saying if forward slash OR astrisk appear..negate.
>
> I would be saying if parenthesis AND asterisk appear in this order... 
> negate
>
> -- Andrew

There would be many ways to do this. One:

>>> import re
>>> r = re.compile(r'/\*(.*?)\*/')
>>> tst = '.a { color: 0xAACC66; /* Fav color */ }'
>>> m = r.search(tst)
>>> m.group(1)
' Fav color '
>>>

HTH

--
Arnaud

Arnaud,

in your expression above..

>>> r = re.compile(r'/\*(.*?)\*/')

what does the 'r' do?

-- andrew


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


Re: Python regex

2008-03-13 Thread &quot;Andrew Rekdal"
made error on last line... read as...

> I would be saying if forward-slash AND asterisk appear in this order... 
> negate


-- 
-- Andrew

"Andrew Rekdal @comcast.net>" < wrote in message 
news:[EMAIL PROTECTED]
>I hope posting is ok here for this question...
>
> I am attempting to extract the text from a CSS comment using 're' such 
> as...
>
> string = "/* CSS comment /*"
> exp = "[^(/*)].*[^(*/)] "
>
> p = re.compile(exp)
> q = p.search(string)
> r = q.group()
>
> print r
>
>>>CSS comment
>
> although this works to a degree... I know the within the brackets 
> everything is taken literally so the pattern
> I am to negating is "(/*)". ie. includes the parenthesis.
>
> So my question is...
>
> Is there a way to negate a pattern that is more than on character long? 
> eg. where rather than saying if forward slash OR astrisk appear..negate.
>
> I would be saying if parenthesis AND asterisk appear in this order... 
> negate
>
>
> -- Andrew
>
> 


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


Python regex

2008-03-13 Thread &quot;Andrew Rekdal"
I hope posting is ok here for this question...

I am attempting to extract the text from a CSS comment using 're' such as...

string = "/* CSS comment /*"
exp = "[^(/*)].*[^(*/)] "

p = re.compile(exp)
q = p.search(string)
r = q.group()

print r

>>CSS comment

although this works to a degree... I know the within the brackets everything 
is taken literally so the pattern
I am to negating is "(/*)". ie. includes the parenthesis.

So my question is...

Is there a way to negate a pattern that is more than on character long? eg. 
where rather than saying if forward slash OR astrisk appear..negate.

I would be saying if parenthesis AND asterisk appear in this order... negate


-- Andrew


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


Class Inheritance

2008-03-12 Thread &quot;Andrew Rekdal"
I am trying to bring functions to a class by inheritance... for instance in 
layout_ext I have..


--- layout_ext.py-
class Layout()
def...some function that rely on css in Layout.py
def...

---EOF--

in the main application file I have...
Layout.py---
from layout_ext import Layout
from CSS import CSS
css = CSS()
class Layout(Layout)
def __init__
more code.

EOF


Problem is layout_ext and Layout code is dependant on a Class instance 
'css'. Whenever the CSS instance it parses a file, this means that I would 
have to parse the file twice?? Why is this? Can I do something like pass an 
already created instance to the import?


-- Andrew


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


Re: help please, splitter windows like in maya or 3ds max

2008-03-12 Thread &quot;Andrew Rekdal"
This seems to work... split then split each side. then tandem the size.

import wx


class Layout(wx.Frame):




def __init__(self, parent, id, title):

wx.Frame.__init__(self, parent, id, title)

sizer = wx.BoxSizer(wx.HORIZONTAL)

panel = wx.Panel(self,-1)


splitter = wx.SplitterWindow(panel)


sizer_left = wx.BoxSizer(wx.VERTICAL)

panel_left = wx.Panel(splitter,-1)

splitter_left = wx.SplitterWindow(panel_left)

splitter_left.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED,self.leftChange,id=splitter_left.GetId())


panel_left_upper = wx.Panel(splitter_left,style= wx.BORDER_SUNKEN)


panel_left_upper.SetBackgroundColour("WHITE")

panel_left_lower = wx.Panel(splitter_left,style= wx.BORDER_SUNKEN)

splitter_left.SplitHorizontally(panel_left_upper,panel_left_lower)

sizer_left.Add(splitter_left,1,wx.EXPAND)


sizer_right = wx.BoxSizer(wx.VERTICAL)

panel_right = wx.Panel(splitter,-1)

splitter_right =wx.SplitterWindow(panel_right)

splitter_right.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED,self.rightChange,id=splitter_right.GetId())

panel_right_upper = wx.Panel(splitter_right,style= wx.BORDER_SUNKEN)

panel_right_lower = wx.Panel(splitter_right,style= wx.BORDER_SUNKEN)

panel_right_lower.SetBackgroundColour("WHITE")

splitter_right.SplitHorizontally(panel_right_upper,panel_right_lower)

sizer_right.Add(splitter_right,1,wx.EXPAND)


splitter.SplitVertically(panel_left,panel_right)


sizer.Add(splitter,1,wx.EXPAND)


panel.SetSizer(sizer)

panel_left.SetSizer(sizer_left)

panel_right.SetSizer(sizer_right)

self.splitter_left = splitter_left

self.splitter_right = splitter_right

def leftChange(self,event):


pos = self.splitter_left.GetSashPosition()

self.splitter_right.SetSashPosition(pos)

event.Skip()

def rightChange(self,event):


pos = self.splitter_right.GetSashPosition()

self.splitter_left.SetSashPosition(pos)

event.Skip()


app = wx.App(0)

k = Layout(None, -1, 'layout.py')

k.Show(True)


app.MainLoop()

-- Andrew

- Original Message - 
From: "moonrie" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
Sent: Wednesday, March 12, 2008 10:19 PM
Subject: help please, splitter windows like in maya or 3ds max


> hi, everyone there, I am doing a 3D modeling project. I like to do it
> with Python( am a newbie), but have no idea with the wxSplitterWindow
> to create the 4-view windows( top, front, side, perspective), like the
> mfc CSplitterWnd guy),
> anyone can give me some help with wxPython?
>
> thanks in advance.
>
> - moonrie 


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


Re: Big file

2008-03-12 Thread Andrew Rekdal
Well, I can see how this could get real messy but within defining a GUI 
there are many elements and so the block of elements such as a wx.notebook 
for instance I would hope I could place all the code for this in another 
file and somehow include it into place. This way I can work on layered 
panels and such in a fresh document rather than travesing through tons of 
widgets and sizers.

Thanks for your replies

-- 
-- Andrew

"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Wed, 12 Mar 2008 19:42:44 -0500, Andrew Rekdal wrote:
>
>> I am working in the class constructor defining elements of an
>> application. The problem is the file is getting unmanageble and I am
>> wanting to extend the contructor __init__ to another file.
>>
>> Is it possible to import directly into the contructor the contents of
>> another module file?
>>
>> If so how would this be done?
>
>
> Here's the way you do what you literally asked for:
>
> class MyClass(object):
>def __init__(self, *args):
># Warning: completely untested
>execfile('myfile.py')  # may need extra arguments?
>
> but you almost certainly don't want to do that. A better way is by
> importing modules, the same as you would for anything else:
>
> class MyClass(object):
>def __init__(self, *args):
>from AnotherModule import constructor
>constructor(self, *args)
>
>
> But frankly if you find yourself needing to do this because your file is
> "too big" and is unmanageable, I think you are in desperate need of
> refactoring your code to make if more manageable. Pushing vast amounts of
> random code out into other files just increases the complexity: not only
> do you have vast amounts of code, but you have large numbers of files to
> manage as well.
>
>
>
>
> -- 
> Steven
>
>
> 


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


Big file

2008-03-12 Thread Andrew Rekdal
I am working in the class constructor defining elements of an application. The 
problem is the file is getting unmanageble and I am wanting to extend the 
contructor __init__ to another file.

Is it possible to import directly into the contructor the contents of another 
module file?

If so how would this be done?

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