Any way to use a range as a key in a dictionary?

2009-03-26 Thread Mudcat
I would like to use a dictionary to store byte table information to
decode some binary data. The actual number of entries won't be that
large, at most 10. That leaves the other 65525 entries as 'reserved'
or 'other' but still need to be somehow accounted for when
referenced.

So there are a couple of ways to do this that I've seen. I can loop
that many times and create a huge dictionary. This isn't a good idea.
I can just assume if a key isn't there that it's not relevant. That's
a better idea.

However I wondered if there was a way to simply use a range as a key
reference somehow. I played around with some options with no success.
Or maybe there was another way to do this with another data type that
I haven't thought about.

Thanks

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


Re: How to interface with C# without IronPython

2009-03-17 Thread Mudcat
On Mar 17, 6:39 am, Kay Schluehr kay.schlu...@gmx.net wrote:
 On 16 Mrz., 23:06, Mudcat mnati...@gmail.com wrote:



  On Mar 13, 8:37 pm, Christian Heimes li...@cheimes.de wrote:

   Chris Rebert wrote:
Haven't used it, butPythonfor .NET sounds like it might be what you
want:http://pythonnet.sourceforge.net/

   I've done some development for and with PythonDotNET. It's definitely
   the right thing. It works with .NET, Mono andPython2.4 to 2.6.

   Christian

  That looks exactly like what I'm searching for. I'll give it a shot.

  One question, the last update for that is back in '07. Do you know if
  it's still in active development?

  Thanks

 Don't think it's maintained right now. But be aware that it runs well
 for the current CLR 2.0.

 For using .NET 3.5 features you just have to add

 c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\

 to your Python path and add assemblies with clr.AddReference as
 convenient.

Based on the archived emails I know that it can work on Python 2.6,
but it's not clear what modifications are necessary. I downloaded the
source files to run independently, and that was capable of running
with installs of Python 2.4 and 2.5. If I download the installer will
it automatically recognize 2.6, or will I need to change paths and
possibly re-compile?

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


Re: How to interface with C# without IronPython

2009-03-16 Thread Mudcat
On Mar 13, 8:37 pm, Christian Heimes li...@cheimes.de wrote:
 Chris Rebert wrote:
  Haven't used it, butPythonfor .NET sounds like it might be what you
  want:http://pythonnet.sourceforge.net/

 I've done some development for and with PythonDotNET. It's definitely
 the right thing. It works with .NET, Mono andPython2.4 to 2.6.

 Christian

That looks exactly like what I'm searching for. I'll give it a shot.

One question, the last update for that is back in '07. Do you know if
it's still in active development?

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


How to interface with C# without IronPython

2009-03-13 Thread Mudcat
All the topics I seem to find on this topic lead me in the direction
of IronPython, but I'm not interested right now in a reimplementation
of Python in .Net environment. There are wrappers and methods
available for integrating with Java, C, and a bevy of other
languages.

I don't know much about .Net. I have it installed and can run the
applications that I need to interface with, but I'd like to get direct
access to the libraries without having to create .exe file
workarounds. Is there a way to do that with CPython?

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


Re: Importing modules

2009-01-21 Thread Mudcat
This is something I've wondered about for a while. I know that
theoretically Python is supposed to auto-recognize duplicate imports;
however I've run into problems in the past if I didn't arrange the
imports in a certain way across multiple files. As a result, I worry
about conflicts that arise because something has been imported twice.
So...I'm not sure if Python *always* gets this correct.

Also, I understand what you're saying about the organization of files
based on modules and maybe regrouping based on use. However I like the
organization of my files to be a grouping of logical components in my
application. This makes it easy to keep things separated and keeps
files from getting to long (which takes longer to program because
you're always bouncing up and down large files). As a result, if I
have to worry about grouping by shared modules then it makes that more
difficult.

I think it would great to have access to a file (like the __init__.py
file for packages) which all the files in the same directory would
have access to for common imports. That way you could push out the
repeated imports and also clean up the look a little bit as well.


On Jan 7, 11:53 am, Paul McGuire pt...@austin.rr.com wrote:
 ...and don't worry about a possible performance issue of importing os
 (or any other module) multiple times - the Pythonimportmanager is
 smart enough to recognize previously importedmodules, and wontimport
 them again.

 If a module uses the os module, then it shouldimportit - that's just
 it.

 Another consideration might be that you are breaking up your own
 programmodulestoo much.  For instance, if I had a program in which I
 were importing urllib in lots ofmodules, it might indicate that I
 still have some regrouping to do, and that I could probably gather all
 of my urllib dependent code into a single place.

 -- Paul

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


Re: Importing modules

2009-01-21 Thread Mudcat
 I think you've probably had issues with circular imports (i.e. mutual
 dependencies), unless you can precisely remember what you were doing and
 what went wrong.

That's possible, but circular imports become more of a hazard if you
have to import in several locations. Unify that to one file, and those
problems are much easier to avoid.

And I don't remember exactly what the problem was, but I think it had
to do with calling Tkinter in two different files. Somehow I was
getting an error in one of the files and removing Tkinter from
importing in one of the files solved it.

 I can make up three or four different logical groupings in my
 applications... so what is 'logical' could not be the same for everyone,
 or from every point of view.

That's not the point. The point is that multiple imports can be a
limiting factor if the module imports don't happen to align with the
model they'd like to use for their file layout.

However playing around with the files, I guess it is possible to
create a file that just does imports and then reference them all just
like you would any other extension of the namespace. I created a file
called imports and was able to access the sys module within it by
importing all from imports and calling sys. That way at least all you
have to do is import the one file each time.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Importing modules

2009-01-21 Thread Mudcat
On Jan 21, 11:29 am, alex23 wuwe...@gmail.com wrote:

 Well, you can always stick those imports into a 'common.py' and do
 'from common import *' in each file that uses them. But doing so can
 be a pain to maintain and debug for anything more than the most simple
 of applications. Being able to see a module's dependencies clearly
 listed at the top of the file is exceptionally handy.

I x-posted the same thing but am curious why you think it's such a
problem to maintain. Having dependencies at the top is handy only
because it's usually quicker to get to the top of a file than it is to
open up another one. However if you have your common file open in your
IDE you can have it open in a split window where it's viewable all the
time. As long as you don't go crazy with import * in your common
file then you shouldn't get into trouble with duplicated namespaces.
As I mentioned before it should also cut down on the circular
imports.

So just preference aside, is there any problems with the actual
execution of the code if it's done this way? To me it simply compares
to putting an __init__ file in a package, except it applies to only
one directory.

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


Re: PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.

2008-12-13 Thread Mudcat
On Dec 12, 6:17 pm, David Boddie da...@boddie.org.uk wrote:
 That's correct, retrieveData() is a protected function in C++ and the
 QMimeData object was created by the framework, not you, in this case.

Ah, well that explains it. Figured as much but was hoping maybe I was
trying to access it incorrectly.


 You could use the data() method to get the serialized data then try to
 extract the list item-by-item using the QDataStream class, or perhaps
 PyQt has a convenience function to unpack the items.

I tried to get info back using data() but kept getting null values.
Same goes for the items() function which is fed with mimeData and is
supposed to return a list. From the documentation it appeared that was
supposed to be the middle-man to re-convert the data. I know the data
existed because I could drag/drop elements from one treeWidget to
another but still couldn't get data back from the target widget.


 Alternatively - and this is a bit speculative - perhaps you can copy
 the data to another QMimeData object which you have created, and use
 its retrieveData() method to retrieve the items.

I started down the path of creating my own MimeType but then realized
it was quicker to just override the drop() function and grab the
selected items from the source widget, just letting the mime data
disappear into the ether. A little klugey but deadline is fast
approaching. However I'll give the pyqt mailing list a shot. I didn't
know there was one just for pyqt.

Thanks for all the help,
Marc



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


PyQt: Pulling Abstract Item Data from Mime Data using Drag and Drop.

2008-12-11 Thread Mudcat
I'm trying to drag/drop info from a TreeWidget into a TextBox. I have
been able to modify the TextEdit box to override the dragEnterEvent
like this:

class TextEdit(QtGui.QTextEdit):
  def __init__(self, title, parent):
QtGui.QTextEdit.__init__(self, title, parent)
self.setAcceptDrops(True)

def dragEnterEvent(self, event):
  if event.mimeData().hasFormat('text/plain'):
event.accept()
  elif (event.mimeData().hasFormat(application/x-
qabstractitemmodeldatalist)):
print event
itemData = event.mimeData().retrieveData(application/x-
qabstractitemmodeldatalist, QtCore.QVariant.List)


The drag is working up until the point I try to actually retrieve the
data. At that point I get an unhandled Runtime Error saying no access
to protected functions or signals for objects not created in Python.
Obviously I am not retrieving them in the correct format. Does anyone
know how to convert/retrieve the information into a Python list?

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


Re: Tkinter: How to get Label wraplength functionality in Text Box

2008-10-30 Thread Mudcat
I'm not sure why my tkinter would not be compiled against 8.5 since I
have the latest version. I assumed that Python 2.6 would have it
without requiring me to do an extra compile.

However I was able to get it working using the code you gave me.
Thanks for that. The only problem is that it seems to simply be
counting newlines (or number of \n). When I use the following:

numlines = widget.count(1.0, end, displaylines, lines)
print Number of lines is , numlines

I get this:

Number of lines is  (153, 1)

So that's not actually the number of lines displayed in the box, just
the number of newline chars it finds. I couldn't find anything in the
tk documentation that would give me any other options to count lines
differently, or number of lines displayed after wrapping.


On Oct 29, 9:10 am, Guilherme Polo [EMAIL PROTECTED] wrote:


 You would need to wrap it and add it as a method to the Text class inTkinter. 
 Fortunately it is easily done:

 importTkinter

 def text_count(self, index1, index2, *options):
     args = [-%s % opt for opt in options]
     args.extend([index1, index2])
     return self.tk.call(self._w, count, *args)

 Tkinter.Text.count = text_count

 Then to try it:

 root =Tkinter.Tk()
 text =Tkinter.Text()
 text.pack()

 text.insert(1.0, a\nb\c\nd)
 print text.count(1.0, end, displaylines, lines)

 root.mainloop()

 Note that I inverted the order of the arguments here, indices and then
 the options or no options. If it doesn't work saying count is not an
 acceptable command then yourtkinteris not compiled against tcl/tk
 8.5 or later.




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


Re: Tkinter: How to get Label wraplength functionality in Text Box

2008-10-30 Thread Mudcat
Awesome...there it goes. I guess my main problem was trying to
evaluate the box before it had been displayed (or all the frame
propagations were finished). The key was getting the Map binding in
there once I got the count functionality to work. After all
that...such a simple function:


def textBoxResize(self, event):
widget = event.widget
dispLines = widget.count(1.0, end, displaylines)
widget.config(height=dispLines)


Thanks for the help!


On Oct 30, 9:19 am, Guilherme Polo [EMAIL PROTECTED] wrote:
 On 10/30/08, Mudcat [EMAIL PROTECTED] wrote:

  I'm not sure why my tkinter would not be compiled against 8.5 since I
   have the latest version. I assumed that Python 2.6 would have it
   without requiring me to do an extra compile.

 It is not really python's fault if tkinter is compiled against tcl/tk
 8.5 or not. The windows installer for python 2.6 happens to include
 tcl/tk 8.5 and tkinter compiled against them, but ubuntu for example
 doesn't distribute tkinter compiled against tcl/tk 8.5 at the moment.



   However I was able to get it working using the code you gave me.
   Thanks for that. The only problem is that it seems to simply be
   counting newlines (or number of \n). When I use the following:

          numlines = widget.count(1.0, end, displaylines, lines)
          print Number of lines is , numlines

   I get this:

   Number of lines is  (153, 1)

 The first is the number of displaylines, the second is the number of lines.



   So that's not actually the number of lines displayed in the box, just
   the number of newline chars it finds.

 Not really. displaylines returns the number of lines displayed in the
 text widget, and lines returns the number of newlines found.
 Note that it is important to call count only after the text widget
 is being displayed, otherwise displaylines won't work correctly (not
 with tk 8.5.3 at least).

  I couldn't find anything in the
   tk documentation that would give me any other options to count lines
   differently, or number of lines displayed after wrapping.

 Try this and check what you get:

 import Tkinter

 root = Tkinter.Tk()
 text = Tkinter.Text()
 text.pack()

 def test(event):
     print displaylines:, text.count(1.0, end, displaylines)
     print lines:, text.count(1.0, end, lines)

 text.insert(1.0, a * 81)
 text.insert(2.0, b\n)
 text.bind('Map', test)

 root.mainloop()

 You should have 3 lines displayed but only 2 real lines.

 --
 -- Guilherme H. Polo Goncalves

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


Re: Tkinter: How to get Label wraplength functionality in Text Box

2008-10-29 Thread Mudcat
Sounds like that would work really well. Problem is I can't get it to
work.

...
AttributeError: Text instance has no attribute 'count'
...

I think my usage is correct. I don't have any params at the moment,
but I was just checking the functionality.

numlines = widget.count()

According to the Tk 8.5 documentation it's used just like a normal
command.
WIDGET COMMAND
pathName count ?options? index1 index2
-chars
-displaychars
-displayindices
-displaylines
-indices
-lines
-xpixels
-ypixels


As for the environment, I thought I had everything set up correctly.
I've got the latest stable version of Python 2.6 (r26:66721, Oct  2
2008, 11:35:03). I'm implementing the TTK wrappers to access Tk 8.5.
Although when I check the wrapper I don't see any mods to the Text
Box. I also don't see this option in the Tkinter.py file.

Is there something else I need to add to access this new feature?


On Oct 28, 6:51 pm, Guilherme Polo [EMAIL PROTECTED] wrote:


 Are you looking for something like the new count command for the
 text widget in tk 8.5 ? count can count the number of logical lines
 (irrespective of wrapping), display lines (counts one for each time a
 line wraps) and some other things.

   Thanks

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

 --
 -- Guilherme H. Polo Goncalves

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


Tkinter: How to get Label wraplength functionality in Text Box

2008-10-28 Thread Mudcat
I've tried quite a few things to get this correct but have hit a
couple of sticking points that I can't figure out. I need to ge the
Text box to function like the 'wraplength' option in a Label.

I've been able to adjust the height of the text by calculating the
number of lines needed to display the text. That's fairly simple. I
know the number of characters in the text and width of the box (which
is static). From that point I can calculate how many lines of display
is needed and resize it.

The problem arises when I use the 'wrap' option of the Text Box so the
words aren't chopped off. Once the wrapping is done there are dead
spaces left at the end of the lines which are ignored when the char
count is done. As a result sometimes the last line is not shown. I can
always just add +1 to the number, but then sometimes I get an empty
line. Space is at a premium in this app, so I have to cut everything
down to use only what's necessary.

So does anyone know how add in those extra spaces to get this to
adjust correctly? (Or if there is another way to get the Text Box to
automatically adjust it's size that I'm not aware of?)

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


Re: Python test case management system?

2008-09-05 Thread Mudcat
 What would the behaviour of such a system be? In other words, what is
 a test case management system in terms of the things that it does?

The feature set for one tends to vary. In short it's a front end app
which is tied to a db that stores and organizes test cases. The system
will allow you to select and execute test cases based on different
criteria which will then log and store the results. They aren't
extremely complicated however they do need to have a well-built
execution engine that are multi-threaded and can handle several
different things at the same time.
--
http://mail.python.org/mailman/listinfo/python-list


Python test case management system?

2008-09-04 Thread Mudcat
I had originally planned on writing my own software for managing test
cases; however new boss = new directive. This will make it more
difficult to get the functionality I need for test cases that are
automated and executed using python.   I've searched for alternatives
but so far haven't come up with any good options.

Does anyone know of a good test case management system written in
python, or possibly another application (either open source or
commercial) that can be extended using python?

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


Writing Unicode to database using ODBC

2008-09-03 Thread Mudcat
In short what I'm trying to do is read a document using an xml parser
and then upload that data back into a database. I've got the code more
or less completed using xml.etree.ElementTree for the parser and dbi/
odbc for my db connection.

To fix problems with unicode I built a work-around by mapping unicode
characters to equivalent ascii characters and then encoding everything
to ascii. That allowed me to build the application and debug it
without running into problems printing to file or stdout to screen.

However, now that I've got all that working I'd like to simply take
the unicode data from the xml parser and then pass it directly into
the database (which is currently set up for unicode data). I've run
into problems and just can't figure why this isn't working.

The breakdown is occurring when I try to execute the db query:

  cur.execute( query )

Fairly straightforward. I get the following error:

  File atp_alt.py, line 273, in dbWrite
cur.execute( query )
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
position 3
79: ordinal not in range(128)

I've verified that query is of type unicode by checking the type a
statement or two earlier (output: type 'unicode').

So then I thought maybe the odbc execute just can't handle unicode
data. But when I do the following command:

  query = query.encode('utf-8')

It actually works. So apparently execute can handle unicode data. The
problem now is that basically the data has been encoded twice and is
in the wrong format when I pull it from the database:

 a
u'+CMGL: (\xe2\u20ac\u0153REC UNREAD\xe2\u20ac\x9d,\xe2\u20ac\x9dREC
READ\xe2\u20ac\x9d,\xe2\u20ac\x9dSTO UNSENT\xe2\u20ac\x9d,\xe2\u20ac
\x9dSTO SENT\xe2\u20ac\x9d,\xe2\u20ac\x9dALL\xe2\u20ac\x9d) OK'
 print a
+CMGL: (“REC UNREADâ€�,â€�REC READâ€�,â€�STO UNSENTâ€�,â€�STO SENTâ
€�,â€�ALLâ€�) OK

The non-alpha characters should be double-quotes. It works correctly
if I copy/paste into the editor:

 d
u'\u201cREC'
 print d
“REC
 d.encode('utf-8')
'\xe2\x80\x9cREC'
 type(d.encode('utf-8'))
type 'str'


I can then decode the string to get back the proper unicode data. I
can't do that with the data out of the db because it's of the wrong
type for the data that it has.

I think the problem is that I'm having to encode data again to force
it into the database, but how can I use the odbc.execute() function
without having to do that?
--
http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter updates - Easiest way to install/use Tile?

2008-08-15 Thread Mudcat
Thanks for all the input! I was able to install 2.6 with the wrapper
file and get up and running quickly.

I like this. I can pass the style object to a separate stylesheet file
where I can create all the definitions. That cleans up a lot of
clutter around the gui widgets. In the past there just didn't seem to
be a good way to create clean code when it came to Tkinter guis
because of all the definitions with each widget creation. Now most of
that can be offloaded somewhere else.

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


Tkinter updates - Easiest way to install/use Tile?

2008-08-13 Thread Mudcat
So I haven't programmed much in Python the past couple of years and
have been catching up the last few days by reading the boards. I'll be
making commercial Python applications again and wanted to see what's
new in the Gui department.

I started using Tkinter several years ago and have a lot of stuff
written in it. As a result, it's hard to switch to another interface
(wxPython, PyQt, etc) with all the hours it would take to reproduce
code I will re-use. (I mention this to avoid the inevitable post
asking why I'm still using it). While I was able to produce some nice
applications in the past and am comfortable with the functionality I
was able to achieve I still wanted to find a way to improve the look
since the old look is even more dated now.

I was reading about Tile, and it sounds like I should be able to wrap
a style around my current code to give it a different look. However it
doesn't sound like it's quite ready for prime time yet. I downloaded
the latest stable version of Python 2.5 which apparently still uses
Tcl 8.4. So my options at this point appear to be:

1) Download beta version of Python 2.6 which has Tcl 8.5.
Tile is supposed to be included with Tcl 8.5, but there's not much
information on how to use it with older code. Do I still need wrapper
code, or if I install 2.6 will it be available already.

2) Install Tcl 8.5 to use with Python 2.5.
How do you do this? In other posts it mentions recompiling source tcl
code with Python. If that's the case it doesn't sound like something I
want to mess with. If I stray too far from default configurations I
start to have problems with py2exe.

3) Install Tile with Python 2.5 and Tcl 8.4 and use wrapper code to
make it work.
However all the posts concerning this approach assume that Tile is
already installed. I downloaded the code for the latest version of
Tile which was a .kit extension. This also may need to be compiled,
and if that's the case I again start to have problems with freezing my
application.

What's the easiest way to do this? I really couldn't find a place that
gave instructions for any of the current release configurations. It
sounds if it's available already in Python 2.6 that it would be the
easiest way, but I couldn't find any threads talking about the
availability of it for that release yet.

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


Outbound HTML Authentication

2007-11-29 Thread Mudcat
Hi,

I was trying to do a simple web scraping tool, but the network they
use at work does some type of internal authentication before it lets
the request out of the network. As a result I'm getting the '401 -
Authentication Error' from the application.

I know when I use a web browser or other application that it uses the
information from my Windows AD to validate my user before it accesses
a website. I'm constantly getting asked to enter in this info before I
use Firefox, and I assume that IE picks it up automatically.

However I'm not sure how to tell the request that I'm building in my
python script to either use the info in my AD account or enter in my
user/pass automatically.

Anyone know how to do this?

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


Re: Python stock market analysis tools?

2007-03-05 Thread Mudcat

 What kind of tool do you want?  Getting quotes is the easy part:

 import urllib
 symbols = 'ibm jpm msft nok'.split()
 quotes = urllib.urlopen( 'http://finance.yahoo.com/d/quotes.csv?s='+
  '+'.join(symbols) + 'f=l1e=.csv').read().split()
 print dict(zip(symbols, quotes))

 The hard part is raising capital and deciding what to buy, sell, or
 hold.

 Raymond

Yeah, I have something that pulls quotes. So the data isn't hard to
get, but I'm not really interested in building the graphs. I was
hoping to find something already built with the common indicators
already built in that I could add my own to.

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


Re: Python stock market analysis tools?

2007-03-05 Thread Mudcat
On Mar 5, 7:55 am, Beliavsky [EMAIL PROTECTED] wrote:

 Yes, and a discussion of investment approaches would be off-topic.
 Unfortunately, newsgroups such as misc.invest.stocks are dominated by
 spam -- the moderated newsgroup misc.invest.financial-plan is better.

 Some research says that mean variance portfolio optimization can
 give good results. I discussed this in a message


I actually checked out some of those newsgroups in trying to find a
tool to use. I think I even posted a question about it. But you're
right in that there's so much spam, and all of the responses I got
were people trying to hock their own wares. Didn't find much in the
way of useful information.


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


Python stock market analysis tools?

2007-03-04 Thread Mudcat
I have done a bit of searching and can't seem to find a stock market
tool written in Python that is active. Anybody know of any? I'm trying
not to re-create the wheel here.

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


Getting started with Crystal Reports...little help in the far court.

2007-01-08 Thread Mudcat
I am not that familiar with Crystal Reports, but having read some other
posts I know that the way to integrate the API with Python is through
the COM interface provide by win32all.

However, I have been unable to find any other information on how to get
started. I've used the COM interface before in integrating Excel and a
couple of other things. So I am familiar with how that works. But there
are at least 40 options dealing with Crystal and Business Objects. I
have no idea which makepy file to create or which one provides the
functionality I need.

I'm not looking to do much. All I'm really trying to do is provide one
application where a list of crystal reports can be selected and ran in
series. Right now we have a lot of reports that all have to be run
manually (takes a while). So I think all I need api access to is server
selection, parameter selection, and output formats.

Any pointers in the right direction would be helpful.

Thanks,
Marc

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


Re: Tkinter: Strange behavior using place() and changing cursors

2006-11-14 Thread Mudcat

Wojciech Mula wrote:
 Mudcat wrote:
  [...]

 You have to set cursor once, Tk change it automatically:

  def buildFrame(self):
  self.f = Frame(self.master, height=32, width=32, relief=RIDGE,
  borderwidth=2)
  self.f.place(relx=.5,rely=.5)
   #self.f.bind( 'Enter', self.enterFrame )
   #self.f.bind( 'Leave', self.leaveFrame )
   self.f.configure(cursor = 'sb_h_double_arrow')


The problem is I need the ability to change it dynamically. I don't
want the cursor to be the double_arrow the whole time the mouse hovers
inside that frame. It's supposed to be a resize arrow when the mouse is
on the frame border, and regular cursor once it passes to the inner
part of the frame.

Unless there is a better way to do this, I have written code to
determine if the mouse is on the edge or not. There doesn't seem to be
a 'mouseover' type event to determine if the mouse is currently on the
frame border itself. As a result, I calculate the position of the mouse
and set the cursor appropriately.

I have also determined that this is not a problem if the button is not
packed inside the frame.  So somehow the interaction of the internal
button is causing this problem.

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


Tkinter: Strange behavior using place() and changing cursors

2006-11-13 Thread Mudcat
I was trying to design a widget that I could drag and drop anywhere in
a frame and then resize by pulling at the edges with the mouse. I have
fiddled with several different approaches and came across this behavior
when using the combination of place() and configure(cursor = ...) This
problem doesn't occur if you remove either one of these elements.

It's a very basic design of a button wrapped in a sizer frame and is
supposed to work like any window that can be resized. The mouse will
change into a resize cursor when it hits the sizer frame (button's
edge).

However when the cursor hits the right edge it gets in some kind of
loop where it keeps entering and leaving the frame. You can also cause
this to happen by entering the widget from the bottom and slowly moving
down. However it doesn't happen if you enter from the left or the top.

Here's the code, boiled down to the basic components that seem to
affect it in some way. Is there something I'm supposed to do in order
to prevent this from happening?

Thanks,
Marc

from Tkinter import *

class Gui:
def __init__(self, master):
master.geometry(200x100)
btn = Widget(master)

class Widget:
def __init__(self, master):
self.master = master
self.buildFrame()
self.buildWidget()

def buildFrame(self):
self.f = Frame(self.master, height=32, width=32, relief=RIDGE,
borderwidth=2)
self.f.place(relx=.5,rely=.5)
self.f.bind( 'Enter', self.enterFrame )
self.f.bind( 'Leave', self.leaveFrame )

def buildWidget(self):
self.b = Button(self.f, text=Sure!)
self.b.pack(fill=BOTH, expand=1)

def enterFrame(self, event):
self.f.configure(cursor = 'sb_h_double_arrow')

def leaveFrame(self, event):
self.f.configure(cursor = '' )

root = Tk()
ent = Gui(root)
root.mainloop()

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


Re: Tkinter: How do I change the actual width of a widget?

2006-11-11 Thread Mudcat
Fredrik Lundh wrote:


 look for pack_propagate on this page for one way to do it:

  http://effbot.org/tkinterbook/button.htm

 /F


Thanks!

I had actually seen this, but on the pythonware site where it looks
like this:

f = Frame(master, height=32, width=32)
f.pack_propagate(0) # don't shrink
b = Button(f, text=Sure!)
b.pack(fill=BOTH, expand=1)

I guess somewhere along the way it became necessary to use the pack
function with propagate.As a result, I was having problems getting it
to work and thought I was doing something else wrong.

And I guess I also missed the fact that Tkinter doc updates are being
done on effbot. I just upgraded my python version after a long time,
and I'm finding out all kinds of interesting things.

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


Tkinter: How do I change the actual width of a widget?

2006-11-10 Thread Mudcat
I am trying to change the width of a widget based on pixel size and not
on characters. I can't figure out how to do this.

Normally to change to the size of a widget it looks like:

widget.configure(width = x)

However that is in characters, not in pixels. To retrieve the actual
size of a widget, I believe it is done with:

x = widget.winfo_width()

Obviously that value can not be used in the configure statement. Is
there a way to dynamically change the width (and height) of a widget
using the winfo data?

Thanks,
Marc

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


Re: python GUIs comparison (want)

2006-11-05 Thread Mudcat

Paul Rubin wrote:


 No that would suck.  Best to try to stay as close as possible to the
 native widgets on whatever the underlying platform is.  If you want
 to depart from the native UI, then start from scratch and write a whole
 new window system with a complete app suite etc.

Ok. But other than thinking it would suck, you're basically repeating
my point about starting from scratch with a whole new suite of widgets.


I think there are situations where having an app that looks completely
different is a big bonus. Having developed apps for both engineers and
non-technical people alike, sometimes the non-techs are much more
impressed by the look/feel than what it actually does.

Sometimes you want a tool that blends in. Sometimes you want one that
stands out, especially when you're competing against other tools where
they all kind of look the same.

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


Re: python GUIs comparison (want)

2006-11-05 Thread Mudcat

Dennis Lee Bieber wrote:

   IOWs, eyecandy with no functionality... Sounds like the same mindset
 that creates entire web sites using Flash animations such that one /can
 not/ access them using a simple fast-loading text modes.


Not exactly. Look...when you're using freeware to compete with OTS
applications then you have to keep up with appearances. One of the apps
I wrote was used by our Sales team to show to customers. These same
customers are used to seeing flashy apps being shown to them all the
time, and we are basically competing against other companies using
these programs.

Anyone who has written apps like this understand what a difference that
first appearances make. You can take the exact same program, give it a
flashier wrapper, and customers will automatically think it offers that
much more. Customers usually only test drive these things long enough
to get a feel for it, not long enough to understand what all it will
do.

Therefore you can get a competitive edge using something that sets it
apart appearance-wise. It has nothing to do with being hollow inside.

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


Re: python GUIs comparison (want)

2006-11-04 Thread Mudcat
I have been using Tkinter for several years now. Recently I have been
thinking about switching to something else that may have a sharper
appearance. However I'm not sure what that may be, and if that
something else is *that* much better than what I'm already using.

Does everyone agree that wxPython looks best on Windows? I've also read
in a couple of places where Dabo looks pretty good as well.

So if someone were to pick a UI that gave the best appearance, what
would they choose?



Kevin Walzer wrote:
 [EMAIL PROTECTED] wrote:
  Now i began to learn GUI programming. There are so many
  choices of GUI in the python world, wxPython, pyGTK, PyQT,
  Tkinter, .etc, it's difficult for a novice to decide, however.
  Can you draw a comparison among them on easy coding, pythonish design,
  beautiful and generous looking, powerful development toolkit, and
  sufficient documentation, .etc.
  It's helpful for a GUI beginner.
  Thank you.
 
 
  :)Sorry for my poor english.
 

 Tkinter:
 Pro: Default GUI library for Python; stable; well-supported
 Con: Needs extension for complex/rich GUI's; core widgets are dated in
 look and feel; many modern extensions in Tcl/Tk have not made it into
 Tkinter or are not widely used (Tile, Tablelist)

 wxPython:
 Pro: Popular, actively developed, wraps native widgets, looks great on
 Windows, commercial-friendly license
 Con: Based on C++ toolkit; docs assume knowledge of C++; some think
 coding style is too much like C++; complex to build and deploy on Linux
  (wraps Gtk)

 PyQt:
 Pro: Powerful, cross-platform, sophisticated GUI's
 Con: Based on C++ toolkit; docs assume knowledge of C++; commercial
 deployment is expensive; free deployment must be GPL; smaller
 development and user community than wxPython

 PyGtk:
 Pro: Sophisticated GUI's, cross-platform (Linux and Win32); very popular
 on some platforms; active development community
 Con: Not native on OS X



 
 
 -- 
 Kevin Walzer
 Code by Kevin
 http://www.codebykevin.com

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


Re: python GUIs comparison (want)

2006-11-04 Thread Mudcat
When you say far better widgets, do you mean that it has a greater
number of widgets to choose from, or that the types of widgets are
basically the same but have a greater amount of flexibility in them?

Personally I find programming in Tkinter fairly simple and
straight-forward. I'm sure a lot of that is due to the fact I've been
using it for a while and have many templates already available when I
start to work on something new. But I don't find myself questioning it
very much for unnecessary typing like I do other things.

As far as appearance goes, I've scoured the net looking for examples of
widgets produced wxPython or other UIs, and I really don't see that
much difference than Tkinter. Now I haven't done a whole lot of
programming on XP, but as far as W2000 is concerned they all look very
similar.

What would be really cool is if someone were to come up with a UI that
has a totally new look and feel than anything that currently exists on
Windows. It seems like most of the native look and feel, even in XP,
are rather boxy and stale. I don't like Macs, but they do have cool
looking windows and frames.

Now I hardly know anything at all about low-level windows calls and
what is/is not possible. But I know that many applications draw their
own windows, skins, and functionality widgets to provide a sharper
appearance. It seems like it would be possible for someone to draw
these widgets and provide an api to display them through Python.


timmy wrote:
 Mudcat wrote:
  I have been using Tkinter for several years now. Recently I have been
  thinking about switching to something else that may have a sharper
  appearance. However I'm not sure what that may be, and if that
  something else is *that* much better than what I'm already using.
 
  Does everyone agree that wxPython looks best on Windows? I've also read
  in a couple of places where Dabo looks pretty good as well.
 
  So if someone were to pick a UI that gave the best appearance, what
  would they choose?
 
 
 i've been using wxpython for a few years and it's great.
 it's got far better widgets then tkinter and it's speed is greater on
 large stuff as well.
 it's got a great support forum and the maintainer robin dunn does a
 great job of answering all questions.
 i can't particularly fault wxpython. it looks great on all platforms and
 maintain the native look and feel of the platofrm as well.

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


Re: Ctypes Error: Why can't it find the DLL.

2006-10-27 Thread Mudcat
That was it. Once I added the other DLLs then it was able to find and
make the call.

Thanks for all the help,
Marc


Bruno Desthuilliers wrote:
 Mudcat a écrit :
  Hi,
 
  I can't figure out why ctypes won't load the DLL I need to use. I've
  tried everything I can find (and the ctypes website is down at the
  moment). Here's what I've seen so far.
 
  I've added the file arapi51.dll to the system32 directory.  However
  when I tried to access it I see this:
 
 (snip)
  WindowsError: [Errno 126] The specified module could not be found
 
  So then I use the find_library function, and it finds it:
 (snip)
  At that point I try to use the LoadLibrary function, but it still can't
  find it:
 (snip)
  WindowsError: [Errno 126] The specified module could not be found
 
  What am I doing wrong? I've used ctypes before and not had this
  problem. Before, I've just added the file to the system32 directory and
  not had this problem.

 Looks like it could have to do with another dll arapi51.dll depends upon
 that would be missing, cf:
 http://aspn.activestate.com/ASPN/Mail/Message/ctypes-users/2593616
 
 HTH

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


Ctypes Error: Why can't it find the DLL.

2006-10-24 Thread Mudcat
Hi,

I can't figure out why ctypes won't load the DLL I need to use. I've
tried everything I can find (and the ctypes website is down at the
moment). Here's what I've seen so far.

I've added the file arapi51.dll to the system32 directory.  However
when I tried to access it I see this:

 print windll.arapi51 # doctest: +WINDOWS
Traceback (most recent call last):
  File interactive input, line 1, in ?
  File C:\Python24\Lib\site-packages\ctypes\__init__.py, line 387, in
__getattr__
dll = self._dlltype(name)
  File C:\Python24\Lib\site-packages\ctypes\__init__.py, line 312, in
__init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Errno 126] The specified module could not be found

So then I use the find_library function, and it finds it:

 find_library('arapi51.dll')
'C:\\WINNT\\system32\\arapi51.dll'

At that point I try to use the LoadLibrary function, but it still can't
find it:

 windll.LoadLibrary('C:\WINNT\system32\arapi51.dll')
Traceback (most recent call last):
  File interactive input, line 1, in ?
  File C:\Python24\Lib\site-packages\ctypes\__init__.py, line 395, in
LoadLibrary
return self._dlltype(name)
  File C:\Python24\Lib\site-packages\ctypes\__init__.py, line 312, in
__init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Errno 126] The specified module could not be found

What am I doing wrong? I've used ctypes before and not had this
problem. Before, I've just added the file to the system32 directory and
not had this problem.

On another note, if I wanted to include these DLL's to be a part of an
installable package, how would I configure ctypes to use DLL's from a
local directory?

Thanks,
Marc

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


Re: Need design advice. What's my best approach for storing this data?

2006-03-18 Thread Mudcat
In doing a little research I ran across PyTables, which according to
the documentation does this: PyTables is a hierarchical database
package designed to efficiently manage very large amounts of data. It
also deals with compression and various other handy things. Zope also
seems to be designed to handle large amounts of data with compression
in mind.

Does any know which of these two apps would better fit my purpose? I
don't know if either of these has limitations that might not work out
well for what I'm trying to do. I really need to try and compress the
data as much as possible without making the access times really slow.

Thanks

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


Need design advice. What's my best approach for storing this data?

2006-03-17 Thread Mudcat
Hi,

I am trying to build a tool that analyzes stock data. Therefore I am
going to download and store quite a vast amount of it. Just for a
general number - assuming there are about 7000 listed stocks on the two
major markets plus some extras, 255 tradying days a year for 20 years,
that is about 36 million entries.

Obviously a database is a logical choice for that. However I've never
used one, nor do I know what benefits I would get from using one. I am
worried about speed, memory usage, and disk space.

My initial thought was to put the data in large dictionaries and shelve
them (and possibly zipping them to save storage space until the data is
needed). However, these are huge files. Based on ones that I have
already done, I estimated at least 5 gigs for storage this way. My
structure for this files was a 3 layered dictionary.
[Market][Stock][Date](Data List). That allows me to easily access any
data for any date or stock in a particular market. Therefore I wasn't
really concerned about the organizational aspects of a db since this
would serve me fine.

But before I put this all together I wanted to ask around to see if
this is a good approach. Will it be faster to use a database over a
structured dictionary? And will I get a lot of overhead if I go with a
database? I'm hoping people who have dealt with such large data before
can give me a little advice.

Thanks ahead of time,
Marc

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


Re: Need design advice. What's my best approach for storing this data?

2006-03-17 Thread Mudcat
On a different tack, to avoid thinking about any db issues, consider
subscribing
to TC2000 (tc2000.com)... they already have all that data,
in a database which takes about 900Mb when fully installed.

That is an interesting option also. I had actually looked for ready
made databases and didn't come across this one. Although, I don't
understand how they can fit all that info into 900Mb.

I like this option, but I guess if I decide to keep using this database
then I need to keep up my subcription. The thing I liked about
downloading everything from Yahoo was that I didn't have to pay anyone
for the data.

Does anyone know the best way to compress this data? or do any of these
databases handle compression automatically? 5gig will be hard for any
computer to deal with, even in a database.

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


Re: Using yacas within Python for symbolis computation

2006-03-17 Thread Mudcat
Out of curiosity, are you also Texas Longhorn JCDenton in another
online life?

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


Need recs on the best graphing interface

2006-03-08 Thread Mudcat
Hi,

I have looked through the previous suggestions on graphing modules and
have been able to find some good suggestions. However I was wondering
about something more specific. I am going to write a program that
tracks stock prices and other financial related charts, so I need to
use the classic stock chart. From the ones I've seen, the graphing
modules deal mostly with scientific plotting and do not have the
high/low type charts.

Does anyone know of a module that contains this type of chart, or one
that can be converted? I was hoping to find one that has done some of
this before I start doing it myself.

Thanks,
Marc

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


Why can't I from module import * except at module level?

2006-01-13 Thread Mudcat
I have a directory structure that contains different modules that run
depending on what the user selects. They are identical in name and
structure, but what varies is the content of the functions. They will
only need to be run once per execution.

Example (directory level):
Sys1:
  A
  B
  C
Sys2:
  A
  B
  C
Sys3:
  A
  B
  C
Sys4:
  A
  B
  C

So if the user selects Sys1 during execution, I want to import the
modules using from * and the run the content of those files.

Now the way my program is set up, it is very important that I be able
to from Sys1 import * and not import Sys1. The names of the
functions inside are passed in from somewhere else and the program
requires those function names to be globally scoped.

So I have a function that looks like this:

def importModules( type ):
cwd = os.getcwd()
path = cwd + \\ + type
sys.path.append(path)

from security import *

Obviously this is not working and I get a syntax error at runtime. So
without this functionality, how do I target modules to import in other
directories after program execution has begun?

Thanks

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


Re: Why can't I from module import * except at module level?

2006-01-13 Thread Mudcat
Anyone?

Is there any way to do this or am must I load all modules by function
name only if it's after initialization?

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


What's the best SNMP interface?

2005-10-11 Thread Mudcat
Hi,

I don't know very much at all about SNMP, but I have an application
where I need to use it. I won't be doing too much with it, just simple
queries for metric values and capturing traps.

I've searched on the net for information but haven't found anything
that recent as to what is the best interface to use. Unfortunately,
sourceforge is down at the moment, so I can't look at any of the
documenation either. But I've read a little about pySNMP and yapSNMP.
I've also read where some people interfaced with modules in C and Tcl
to interface with it.

I'm not really concerned with speed. I just need something simple that
will not require me to spend much time trying to integrate it with the
test platform I already have. 

Thanks for any info,
Marc

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


Re: How to change deafult tab traversing (radiobuttons panel)

2005-06-06 Thread Mudcat
I just figured this out myself, but probably not the way you're asking.
There are supposed to be ways to change the tab order using
tk_focusNext() and tk_focusPrevious(), but I've never used it.

What I've done is simply point one widget to the next one, basically
creating a linked list of tabs. I only had a couple that I wanted to
change the order of, so this was pretty easy to change.

I bound the widgets I wanted changed to tab and had a function that
knew where to go. Here's a simple example:

def tab(self, event):
self.port.component('entry').focus_set()

return 'break'

The return 'break' is very important, because if you don't include it
then the default tab functionality of window will be used which will
override whatever changes you make.

I had problems using the tk_focusNext() and tk_focusPrevious() commands
because the two widgets that were supposed to be next to each other in
order were in different windows. I kept getting errors when I tried it.


And since I only had two widgets I created two different functions to
handle the tabs. But if I had more than two I would have created a
forwarding table based on widget names or ids using the event that is
returned in the callback from the binding. Based on the event id
returned I would know where to set focuse next.

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


Re: py2exe problems with win32com [ EnsureDispatch('ADODB.Connection') ]

2005-05-26 Thread Mudcat
I'm not positive about this, but when using com you need to force it
into the compile. In my applications where I use Excel I use this line:

python setup.py py2exe --progid Excel.Application

You may need to do something similar for the db application.

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


Re: Design problem...need some ideas

2005-05-26 Thread Mudcat
bump

Anyone? I don't need code. Just widgets and a compass for the right
direction.

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


Design problem...need some ideas

2005-05-25 Thread Mudcat
Howdy,

I'm trying to create a selection helper, just like in Google or other
places where a drop-down menu appears below the text selection box when
you enter some text. As you type, the choices are narrowed based on the
characters entered.

I have everything worked out but the actual menu which is giving me
problems. My first attempt was using a Pmw.ScrolledListBox and taking
advantage of the inherent drop-down menu. I was attempting to invoke
the menu and change the list as characters were typed.

However, I found I was getting focus problems. When the menu is
invoked, focus in the entry box is lost which makes it impossible for
the user to continue typing his selection. When focus is returned to
the entry box, the drop-down menu disappears. Is there a way to make
this work?

Or, is there a better way? My Plan B was to create a new toplevel
window and place it using screen geometry to appear right below the
entry box. The window was going to contain just a listbox that
contained the selections. But I fear this may pose many more problems,
focus just being one of them.

Thanks ahead of time for the help,
Marc

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


Re: Confusing: Canvas image working in function but not in class

2005-04-23 Thread Mudcat
I will answer my own question in case anyone else ever has this
problem.

I knew the problem (although some say it's not) existed with the
namespace of pictures, that if you didn't save the pictures in
persistent memory they would disappear as soon as the function that
called them was exited. So a while ago I went through this and fixed it
by saving all my pictures and widgets that held them as class objects.

However, apparently I was causing the same thing to happen by not
saving the class instance as an object of the class that called it. So
this fixed it:

def uts5100(self):
self.sys5100 = UTS5100( self.master )

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


Re: Python Win32 Extensions and Excel 2003. OL 11.0 Supported?

2005-04-21 Thread Mudcat
Yeah, yall are right. I did the same thing and found it pulling
different versions depending on which system I was on.

However I was confused because I tried to use an older version of
python win with Excel 2003 a couple of years ago, and it wouldn't work.
Somehow it couldn't handle OL 11.0. So I figured there must be a
connection in there somewhere that allows it to understand.

But as I sit here and type I'm wondering if this had more to do with
freezing the application which is what I was doing. I may have been
sending a compiled version of makepy (which back then was genpy) which
was compiled under an Office 2000 machine trying to get it to work on
an Office 2003 machine.

Now I could have sworn that at some point I removed the contents of the
genpy directory in the package I sent out, which would force each
machine to build one before it ran. But this was a problem I ran into
early and was told to not worry about at the time. Now I have to worry
about it more.

Anyone else have to package builds of com applications that need to be
supported on different versions of Office? A few tips on how to make
that run smoother would be some sweet info.

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


Confusing: Canvas image working in function but not in class

2005-04-21 Thread Mudcat
I have an image that displays on a canvas that works unless I put the
same code in a class. I can't figure that out. Here's what works:

def uts5100(self):
self.screen = Toplevel( self.master )
self.screen.geometry(+100+50)
self.screen.grab_set()
self.screen.focus_set()

self.screenType = uts5100

self.canvas = Canvas(self.screen)

self.canvas.create_image(20, 20, image = self.empty5100,
anchor=NW, tags = chasis )

self.canvas.pack()

The image is opened in another function:

def openImages(self):
self.empty5100 = ImageTk.PhotoImage( Image.open(Images/ +
5100empty.bmp) )


However if I do the same thing, but in it's own class, the image does
not appear:

def uts5100(self):
sys5100 = UTS5100( self.master )

class UTS5100:
def __init__(self, master):
self.master = master
self.openImages()
self.draw()

def openImages(self):
self.empty5100 = ImageTk.PhotoImage( Image.open(Images/ +
5100empty.bmp) )


def draw(self):
self.screen = Toplevel( self.master )
self.screen.geometry(+100+50)
self.screen.grab_set()
self.screen.focus_set()

self.screenType = uts5100

self.canvas = Canvas(self.screen)

self.image = self.canvas.create_image(20, 20, image =
self.empty5100, anchor=NW, tags = chasis )

self.canvas.pack()


They are called from a button that when pressed creates the window
where the image is supposed to appear. Obviously there is something
that I am missing when putting this window into it's own class, but I
can't figure it out.

Anyone got an idea why this is happening?

Thanks

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


Python Win32 Extensions and Excel 2003. OL 11.0 Supported?

2005-04-20 Thread Mudcat
Howdy,

I could have sworn I downloaded a version of python win that supported
object library 11.0 at some point. However I just downloaded versions
204 and 203, and the highest version they have is OL 9.0.

Does anyone know if this is a mistake or if Excel 2003 isn't yet
supported with the extensions?

Thanks,
Marc

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


How do I enter/receive webpage information?

2005-02-04 Thread Mudcat
Hi,

I'm wondering the best way to do the following.

I would like to use a map webpage (like yahoo maps) to find the
distance between two places that are pulled in from a text file. I want
to accomplish this without displaying the browser.

I am looking at several options right now, including urllib, httplib,
packet trace, etc. But I don't know where to start with it or if there
are existing tools that I could incorporate.

Can someone explain how to do this or point me in the right direction?

Thanks,
Marc

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


How do I delete the bound character which triggered callback?

2005-01-31 Thread Mudcat
Howdy,

I have a simple combox that I have commands entered into which looks
like this:

This is a list with the commands to be run in rotisserie
fasion.
self.comList = Pmw.ComboBox(self.boxFrame, labelpos=W,
label_text='Command List: ', entry_width=20,
selectioncommand=self.temp )

self.comList.pack(side=LEFT)

self.comList.component('entry').bind(';', self.enterCommand)


I have bound the ';' key because that is the terminating character in
the protocol we are using, and once that is entered the entry is
complete. Basically it skips the normal methond this box uses to
capture commands.

However, I can't get rid of it once the call is made. This is what I'm
doing on the callback:

def enterCommand(self, widget):
# Get current list of commands, must convert to list
comTuple =  self.comList.get(0, END)
commandsList = list( comTuple)

# Get current command entered into the entry field
currentCommand = self.comList.component('entry').get()
currentCommand += ;
print currentCommand

# Append new entry into current list and set the new list
commandsList.append(currentCommand)
self.comList.setlist( commandsList )

self.comList.component('entryfield').delete(0,END)

At the end of this function I want to completely erase everything in
the entryfield. However it erases everything but the bound key, ';'.
Does anyone know how to erase that one as well?

Thanks,
Marc

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