[Tutor] Grid Manager Positioning

2007-11-28 Thread Johnston Jiaa
How do I get widgets to be on the extreme left and right sides of a frame using the grid manager? My code is similar to this.. big_frame = Frame(root) big_frame.grid(sticky=W+E) left_frame = Frame(big_frame) left_frame.grid(row=0, column=0, sticky=W) ri

[Tutor] Starting a browser instance and passing a parameter to it.

2007-11-28 Thread Don Taylor
I am trying to start a browser from within a Python program and I want it to show a local file on my system and I want to pass a parameter to that browser page that will be picked up by some Javascript embedded in the page. I have this code: import webbrowser webbrowser.open("file:///D:/Eclips

[Tutor] [wxPython-users]How to avoid the traces of frame or panel window

2007-11-28 Thread Varsha Purohit
Hello Everyone, I created a simple frame, but when i move the frame or any panel window i get traces of the windows all over which makes the screen look shabby. How can i avoid getting them ? sample code for a panel is # simple.py import wx app = wx.App() frame = wx.Frame(None, -1, 's

Re: [Tutor] Variables and Functions

2007-11-28 Thread Michael H. Goldwasser
Hello Devon, Here's a quick [untested] push in the direction of taking the code you gave below and modeling it as a class using an object-oriented design. With this code, you could then create an instance of a puzzle as: toughOne = Sudoku() toughOne.play_game() Within

Re: [Tutor] Variables and Functions

2007-11-28 Thread Tiger12506
Okay. "Class" is not a module. It is a keyword that defines a new type. Similar to an integer, or a string. But in the case of a class, you define what happens when you add, subtract, open, close, etc. by defining "methods" of a class. A classic example is a car. class Car: running = 0 head

Re: [Tutor] Variables and Functions

2007-11-28 Thread Devon MacIntyre
Hi, I have two functions, 'new_sudoku' and 'play_game'. In new_sudoku, I have a pre-determined puzzle (I wasn't able to get a randomly generated puzzle working), as a matrix in the variable 'puzzle'. I imported the 'copy' module and made a deep-copy of 'puzzle' to make 'new_puzzle', which randomly

Re: [Tutor] Variables and Functions

2007-11-28 Thread Alan Gauld
"Devon MacIntyre" <[EMAIL PROTECTED]> wrote > Just wondering, how would I get a variable out of one function and > into > another? return the value from one function and pass it as an argument to the other. Example: def oneFunction() x = [1,2,3] return x def another(aValue): pr

Re: [Tutor] update a ws.ListBox

2007-11-28 Thread Alan Gauld
"Alan Gauld" <[EMAIL PROTECTED]> wrote > >>> import wx > >>> help(wx.ListBox. > > Should display a list of long methods which you can browse and view Doh! Should be "... a long list of methods..." of course. :-( Alan G. ___ Tutor maillist - Tutor

Re: [Tutor] Python CMS advice wanted

2007-11-28 Thread Alan Gauld
"Richard Querin" <[EMAIL PROTECTED]> wrote > After reading it all I'm wondering if maybe a templating system like > Cheetah might be the way to go for us. For a simple CMS a templating system like Kid or Cheetah are probably all you need. If you want to include dynamic content add CherryPy or sim

Re: [Tutor] Variables and Functions

2007-11-28 Thread Kent Johnson
Devon MacIntyre wrote: > Hi, > Just wondering, how would I get a variable out of one function and into > another? I don't understand your description of your situation, maybe you could show a little code as a simple example? The usual way to get a variable out of a function is to return a valu

Re: [Tutor] two way dictionary

2007-11-28 Thread ingo janssen
On Nov 28, 2007 8:16 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > ingo janssen wrote: > > Is there a dict that works "both ways"? > > another implementation here: > http://www.radlogic.com/releases/two_way_dict.py > Perfect, never thought to actually search for 'two way dict'. Thanks Kent. Ingo

Re: [Tutor] Variables and Functions

2007-11-28 Thread Tiger12506
Sounds like an excuse for a global (aggh!) variable. Or more properly, wrap all of the relevant functions in a class and use a class variable for your puzzle - Original Message - From: "Devon MacIntyre" <[EMAIL PROTECTED]> To: Sent: Wednesday, November 28, 2007 4:00 PM Subject: [Tutor]

[Tutor] Variables and Functions

2007-11-28 Thread Devon MacIntyre
Hi, Just wondering, how would I get a variable out of one function and into another? I'm trying to make a Sudoku puzzle for Python 2.5.1, and in one function I have the finished puzzle (as a matrix) called 'puzzle'. Using the 'copy' module I made a deep copy called 'new_puzzle'. That function is ca

Re: [Tutor] update a ws.ListBox

2007-11-28 Thread Alan Gauld
I'm not sure this is exactly what you want but it does something like it: def OnListBox1(self, event): index = event.GetSelection() choice = self.listbox1_items[index] if choice == 'item1': ret = ['choice1', 'choice2'] elif choice == 'item2': ret = ['choice3', 'choi

Re: [Tutor] two way dictionary

2007-11-28 Thread Kent Johnson
ingo janssen wrote: > Is there a dict that works "both ways"? Some discussion here: http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/c5ab5cf524a158be/2a4a941d55e011be?hl=en&rnum=1&_done=%2Fgroup%2Fcomp.lang.python%2Fbrowse_frm%2Fthread%2Fc5ab5cf524a158be%2F4c02e7b9c3b44c37%3F

Re: [Tutor] distutils: how to include a header file belonging to an extension module

2007-11-28 Thread Evert Rol
> I have a small C-extension module, consisting of 3 files > (ndcombine_module.c, combine.c & combine.h). I can build the > extension find 'in place' using distutils, but when creating a > distribution (with setup.py sdist), the combine.h header file > seemingly gets lost and I cannot build

Re: [Tutor] Getting a binary value from a file

2007-11-28 Thread Kent Johnson
Chuk Goodin wrote: > I have a file full of "integers". If I get a file handle (e.g. file1) > and then read something in, I get back some hex value. How can I go on > to use that in my program? > > For example, in interactive mode, file1.read(4) gets me an output of > '/x00/x00/x00/x1c' (might

[Tutor] two way dictionary

2007-11-28 Thread ingo janssen
for a little cherrypy app I'm working on I wrote the piece of code below. Goal is to obscure the first part of a directory path(s) the user is browsing. Replacing the first part of the path with an alias works fine, but for the application it has to work both ways. I know how to swap the keys and v

Re: [Tutor] update a ws.ListBox

2007-11-28 Thread Jason Massey
Inserting this line: self.listbox2.InsertItems([choice],0) in your OnListBox1 method after your if/then/else statement puts the item you select in ListBox1 appear in ListBox2. You have to force choice into a list, otherwise it will insert each individual letter in the string into the box one at

[Tutor] Getting a binary value from a file

2007-11-28 Thread Chuk Goodin
Okay, I actually can load the value fine, but then I'm not sure how to do anything with it. I have a file full of "integers". If I get a file handle (e.g. file1) and then read something in, I get back some hex value. How can I go on to use that in my program? For example, in interactive mode, fil

[Tutor] update a ws.ListBox

2007-11-28 Thread John Gerdeman
Hello, I'm trying to create a gui using wxpython on ubuntu 6.10 (read, that some functions of wx differ on different OS). I have two Listbox items, Listbox1 and Listbox2. I want to update Listbox2 according to the choice made in Listbox1. I already looked at the wx API doc, but only found method

[Tutor] distutils: how to include a header file belonging to an extension module

2007-11-28 Thread Evert Rol
(this may not be a py-tutor question, but well) I have a small C-extension module, consisting of 3 files (ndcombine_module.c, combine.c & combine.h). I can build the extension find 'in place' using distutils, but when creating a distribution (with setup.py sdist), the combine.h header file

Re: [Tutor] Python CMS advice wanted

2007-11-28 Thread sa9k063
Richard Querin wrote: > - Python based - I have a rudimentary knowledge of Python and like it, so > I'd prefer to go this route > - Simple - Our needs are not very complex, we're really just thinking about > maintainability and expandability. > - We want to be able to customize the look and layout

Re: [Tutor] List processing question - consolidating duplicate entries

2007-11-28 Thread Kent Johnson
Michael Langford wrote: > What you want is a set of entries. Not really; he wants to aggregate entries. > # remove duplicate entries > # > # myEntries is a list of lists, > #such as [[1,2,3],[1,2,"foo"],[1,2,3]] > # > s=set() > [s.add(tuple(x)) for x in myEntries] A set can be constructed d

Re: [Tutor] List processing question - consolidating duplicateentries

2007-11-28 Thread Tiger12506
> s=set() > [s.add(tuple(x)) for x in myEntries] > myEntries = [list(x) for x in list(s)] This could be written more concisely as... s = set(tuple(x) for x in myEntries) myEntries = [list(x) for x in list(s)] Generator expressions are really cool. Not what the OP asked for exactly. He wanted to