You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(116) |
Sep
(146) |
Oct
(78) |
Nov
(69) |
Dec
(70) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(188) |
Feb
(142) |
Mar
(143) |
Apr
(131) |
May
(97) |
Jun
(221) |
Jul
(127) |
Aug
(89) |
Sep
(83) |
Oct
(66) |
Nov
(47) |
Dec
(70) |
2003 |
Jan
(77) |
Feb
(91) |
Mar
(103) |
Apr
(98) |
May
(134) |
Jun
(47) |
Jul
(74) |
Aug
(71) |
Sep
(48) |
Oct
(23) |
Nov
(37) |
Dec
(13) |
2004 |
Jan
(24) |
Feb
(15) |
Mar
(52) |
Apr
(119) |
May
(49) |
Jun
(41) |
Jul
(34) |
Aug
(91) |
Sep
(169) |
Oct
(38) |
Nov
(32) |
Dec
(47) |
2005 |
Jan
(61) |
Feb
(47) |
Mar
(101) |
Apr
(130) |
May
(51) |
Jun
(65) |
Jul
(71) |
Aug
(96) |
Sep
(28) |
Oct
(20) |
Nov
(39) |
Dec
(62) |
2006 |
Jan
(13) |
Feb
(19) |
Mar
(18) |
Apr
(34) |
May
(39) |
Jun
(50) |
Jul
(63) |
Aug
(18) |
Sep
(37) |
Oct
(14) |
Nov
(56) |
Dec
(32) |
2007 |
Jan
(30) |
Feb
(13) |
Mar
(25) |
Apr
(3) |
May
(15) |
Jun
(42) |
Jul
(5) |
Aug
(17) |
Sep
(6) |
Oct
(25) |
Nov
(49) |
Dec
(10) |
2008 |
Jan
(12) |
Feb
|
Mar
(17) |
Apr
(18) |
May
(12) |
Jun
(2) |
Jul
(2) |
Aug
(6) |
Sep
(4) |
Oct
(15) |
Nov
(45) |
Dec
(9) |
2009 |
Jan
(1) |
Feb
(3) |
Mar
(18) |
Apr
(8) |
May
(3) |
Jun
|
Jul
(13) |
Aug
(2) |
Sep
(1) |
Oct
(9) |
Nov
(13) |
Dec
|
2010 |
Jan
(2) |
Feb
(3) |
Mar
(9) |
Apr
(10) |
May
|
Jun
(1) |
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(4) |
2011 |
Jan
|
Feb
|
Mar
(10) |
Apr
(44) |
May
(9) |
Jun
(22) |
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(3) |
Aug
(8) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Howard H. <hr...@co...> - 2005-10-04 18:01:35
|
Mark, you will need a version of wxpython that is compatible with version 2.4 of python. Go to http://www.wxpython.org/download.php to get a version of wxpython that is compatible with your version of python. I had the same problem you did when I used SourceForge's installation instructions to install pythoncard on a computer running Windows XP and version 2.4 of python. So far I haven't been impressed with "Beginning Python". To many mistakes, a lot of the explanations are awkwardly worded and the coverage of beginning topics book is to limited. I have found the book "Python" by Chris Feely to be much better for learning python and for gaining an appreciation of some of the complicated things you can do with python with just a few lines of code. Howard -----Original Message----- From: pyt...@li... [mailto:pyt...@li...] On Behalf Of pha...@mi... Sent: Monday, October 03, 2005 11:54 AM To: pyt...@li... Subject: [Pythoncard-users] Installing PythonCard Problems I'm using SuSE Pro 9.3, and it installed python 2.4 An attempted installation of pythonCard 8.1 (0.8.1-1mdk), YAST informs me I need python-base 2.3. I presume this means Python 2.3. Is it possible to install pythonCard with python 2.4? If not, how do I install a previous version of python without losing python 2.4? I'm reading the new book "Beginning Python" by Peter C Norton, et al, and I'd like to go through the examples the way it wants. Looks like a good book, to this point. Mark ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Pythoncard-users mailing list Pyt...@li... https://lists.sourceforge.net/lists/listinfo/pythoncard-users |
From: <pha...@mi...> - 2005-10-03 16:53:18
|
I'm using SuSE Pro 9.3, and it installed python 2.4 An attempted installation of pythonCard 8.1 (0.8.1-1mdk), YAST informs me I need python-base 2.3. I presume this means Python 2.3. Is it possible to install pythonCard with python 2.4? If not, how do I install a previous version of python without losing python 2.4? I'm reading the new book "Beginning Python" by Peter C Norton, et al, and I'd like to go through the examples the way it wants. Looks like a good book, to this point. Mark |
From: Alex T. <al...@tw...> - 2005-09-29 22:19:42
|
Alex Tweedly wrote: > Kevin Altis wrote: > >> I would just go ahead and add it as a new sample. The more the merrier. >> > Unfortunately, I've now seen what it looks like on the Mac. It needs > some work before I'll upload it :-( > > On the other hand, I do now have a Mac :-) > > Having some problems getting things set up well enough to do anything > useful - but hopefully in a day or two I'll get past that and be able > to test things against PythonCard for Mac as well as for Windows ... > > OK, done; Sudoku Solver is now added to the samples in CVS. It took some slightly funky sizer magic to get this to work, but it's now at least reasonable on Mac. The Mac always shows a scroll bar on a List component, so it makes the squares much larger than they were on Windows. On the Mac, the minimum size reported (by GetBestSize()) is a size that shows two lines of the list (which is enough because there's a scroll bar). But for this app, we really, really want all three lines to show - so I had to put in some platform-specific code to force the minimum size to be larger. Still have the problem that Mac doesn't properly show background colour for a List component, so it is a bit lacking in visual feedback compared to the Windows version. I tried using foreground colour instead, but it doesn't work right either. I'm going to keep trying to see if there's some other way to improve the visual feedback that will work. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.8/114 - Release Date: 28/09/2005 |
From: Andrew P <gr...@gm...> - 2005-09-28 16:12:07
|
Awesome. Thank you so much. This was the obvious bit I was missing. I just needed a nudge towards blit. I'm sure this is all pretty obvious to anybody whose programmed with a GUI before, or at least drawn anything out in one. I already have a generator function, which returns the next iteration ad nauseum. I managed to build a window down from the top row with one drawPointList at a time, and it worked really well. But when I got to the bottom I just started scratching my head. My first algorithm looked a lot like yours. After tweaking pure Python as much as I could I ended up with: def makeArray1(firstrow): result =3D firstrow[:] result[0][w/2] =3D 1 for row in range(h-1): last =3D result[row] next =3D result[row+1] for i in range(w-1): next[i] =3D rule[4*last[i-1]+2*last[i]+last[i+1]] next[i+1] =3D rule[4*last[i]+2*last[i+1]+last[0]] return result Which gets a bit ugly because it's quite a bit faster to assign directly to an index, than to append. And pulling the row lookups out of the inner loop also speeds it up quite a bit. It's very fast with psyco (about 20x), but I suspect yours (and my first readable one) would be about the same once compiled. That was the fastest native version I came up with tho. With numpy I got within 20% or so of psycos performance, and stayed cross-platform. My iBook really appreciated this, my brain did not. I feel like I'm making excuses for my ugly numpy algorithm, which is almost entirely incomprehensible to me. I guess there's no sin in optimizing an inner loop that applies to a million elements. Especially with an iBook involved. The only other interesting tidbit was it was faster to do all that 1<<element&rule stuff than to just use a lookup table to get a 1 or 0. So numpy is just bloody fast. Or maybe array access is slow. I don't care. I'm done with that bloody algorithm :) Thanks again! Andrew On 9/28/05, Alex Tweedly <al...@tw...> wrote: > > Andrew P wrote: > > > Hi Alex, > > > > Let me explain a little more what I'm trying to do. First off. here > > is a screenshot of what I did today: > > > Cool. Thanks Andrew - I have a much better idea now. > > Here's what I believe (tell me if I'm wrong), followed by what I > conclude from those beliefs. > > You're doing CA where each row depends on the previous row (or perhaps > in the future on previous rows). > Once a cell's value has been determined, it never changes. > You need to scroll as the cells are determined - not backwards and > forwards under user control. > > From that I conclude: > > You should calculate one row at a time, draw it, and then move on to the > next one. > You should use one one-dim arrays (lists) to hold the previous and > current rows > You should scroll by using bit-blits, not by re-drawing. > > so (after the initial phase to fill the window), what you'll do in each > cycle through the loop is > > calculate the next line > scroll the current window up by one line > draw in newly calculated row at bottom of window. > > > Here's the core part of a sample program to do that .... no doubt it > could be improved, but I kept it as simple so I could figure it out. I > use a button called "Change" so I can single-step through the process, > and when I run with the timer, I simply call the single-step function - > could certainly be cleaned up :-) > > (And for the boundary condition at start/end of the list, I used a > try... except ... - very lazy of me). > > > def draw_row(self, y): > > points =3D [] > > pens =3D [] > > for i in range(self.width): > > if self.cells[i]: > > points.append( (i,y) ) > > pens.append( self.basicpen ) > > self.components.bmpCanvas.drawPointList( points, pens ) > > > > > > def on_Change_mouseClick(self, event): > > if self.row =3D=3D 0: > > self.draw_row(0) > > self.row +=3D 1 > > return > > > > start =3D time.clock() > > > > if self.row >=3D self.height: > > cv =3D self.components.bmpCanvas > > cv.blit( (0,0), (self.width,self.height), cv._bufImage, (0,1)) > > cv.drawRectangleList( [ (0,self.height, self.width,1)], > > [self.whitepen]) > > y =3D self.height > > else: > > y =3D self.row > > > > cells =3D self.change(self.cells) > > self.cells =3D cells > > > > self.draw_row(y) > > self.row +=3D 1 > > > > ## print "took ", time.clock()-start > > return > > > > def on_bmpCanvas_timer(self, event): > > self.on_Change_mouseClick(event) > > return > > > > > > def change(self, cells): > > new =3D [] > > rule =3D [ 0, 1, 1, 0, 1, 0, 0, 1 ] > > > > for i in range(len(cells)): > > try: > > newval =3D 4*cells[i-1] + 2*cells[i] + cells[i+1] > > except: > > newval =3D 0 > > new.append( rule[newval] ) > > return new > > > If you want the entire sample, let me know .... > > -- > Alex Tweedly http://www.tweedly.net > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 23/09/200= 5 > > |
From: Alex T. <al...@tw...> - 2005-09-28 14:43:38
|
Andrew P wrote: > Hi Alex, > > Let me explain a little more what I'm trying to do. First off. here > is a screenshot of what I did today: > Cool. Thanks Andrew - I have a much better idea now. Here's what I believe (tell me if I'm wrong), followed by what I conclude from those beliefs. You're doing CA where each row depends on the previous row (or perhaps in the future on previous rows). Once a cell's value has been determined, it never changes. You need to scroll as the cells are determined - not backwards and forwards under user control. From that I conclude: You should calculate one row at a time, draw it, and then move on to the next one. You should use one one-dim arrays (lists) to hold the previous and current rows You should scroll by using bit-blits, not by re-drawing. so (after the initial phase to fill the window), what you'll do in each cycle through the loop is calculate the next line scroll the current window up by one line draw in newly calculated row at bottom of window. Here's the core part of a sample program to do that .... no doubt it could be improved, but I kept it as simple so I could figure it out. I use a button called "Change" so I can single-step through the process, and when I run with the timer, I simply call the single-step function - could certainly be cleaned up :-) (And for the boundary condition at start/end of the list, I used a try... except ... - very lazy of me). > def draw_row(self, y): > points = [] > pens = [] > for i in range(self.width): > if self.cells[i]: > points.append( (i,y) ) > pens.append( self.basicpen ) > self.components.bmpCanvas.drawPointList( points, pens ) > > > def on_Change_mouseClick(self, event): > if self.row == 0: > self.draw_row(0) > self.row += 1 > return > > start = time.clock() > > if self.row >= self.height: > cv = self.components.bmpCanvas > cv.blit( (0,0), (self.width,self.height), cv._bufImage, (0,1)) > cv.drawRectangleList( [ (0,self.height, self.width,1)], > [self.whitepen]) > y = self.height > else: > y = self.row > > cells = self.change(self.cells) > self.cells = cells > > self.draw_row(y) > self.row += 1 > > ## print "took ", time.clock()-start > return > > def on_bmpCanvas_timer(self, event): > self.on_Change_mouseClick(event) > return > > > def change(self, cells): > new = [] > rule = [ 0, 1, 1, 0, 1, 0, 0, 1 ] > > for i in range(len(cells)): > try: > newval = 4*cells[i-1] + 2*cells[i] + cells[i+1] > except: > newval = 0 > new.append( rule[newval] ) > return new If you want the entire sample, let me know .... -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 23/09/2005 |
From: Andrew P <gr...@gm...> - 2005-09-28 05:19:38
|
Hi Alex, Let me explain a little more what I'm trying to do. First off. here is a screenshot of what I did today: http://www.stefanscott.com/ca_example.jpg That is a 500x400 cellular automata, and a little cramped. What I'd like to do is have it scroll, and this is why I was asking about the best way to draw my numpy array. Optimizing is one thing, not being stupid because you don't know how to draw to the canvas properly is another :) I just found this java example of what I'm trying to do, picture worth a thousand words and all that: http://math.hws.edu/xJava/CA/ Right now I convert to a point list and draw, which is really slow. For instance, with my array code below, I get: >>> timeIt(10) 1.1327484359 Which I am happy with. My original non-numpy code was 20x slower :) That's ten calculations of a 1000x1000 CA, which is more the size I am shooting for. I have a point, I promise.. Lets say I want a scrolling speed of 2 seconds a screen, gives me 2 seconds to calculate 1000 lines, so back of the napkin puts me at about .15 seconds to calculate 1000 lines on my machine, which is much less than 2 seconds, and is great for my 1ghz Apple iBook even. So far so good. But then I try timing the conversion of my array to a point list: >>> a =3D do_ca(1000,1000,90) >>> def timePL(num): ... res =3D [] ... t1 =3D time.clock() ... for i in range(num): ... for i in range(1000): ... [res.append([x,i]) for x in nonzero(a[i])] ... res =3D [] ... t2 =3D time.clock() ... print t2 - t1 ... >>> timePL(10) 1.06879561509 It takes me 1/10th of a second just to convert my numpy array to a point list! Which puts me at 100 seconds if I wanted to scroll a full screen one line at a time. More realistically, the scrolling would probably take place at maybe 25 fps, or so. But that would still be 40 redraws, or 4 seconds at full steam ahead on my fairly fast and modern computer, let alone my poor iBook. I have to reiterate this is my first GUI app ever, and it's amazing what I've done just today in my first day of Pythoncard. But I'm definitely not trying for speed for the sake of speed. I just need to know how to do it right. I'd like to draw it as it calculates, and have it scroll when it reaches the bottom. Popping off the first row of my array and calculating the next bottom row is practically instant in numpy, but then I'm stuck wit= h that slow iteration over each element. Which is why I was wondering if ther= e was a way to draw the array directly, without an RGB or point list conversion inbetween. I don't even think I can cache the points list, since I'd still have to interate over it to do +1 to the row coordinates. Which may be faster, but still feels like I'm polishing a turd :) Am I missing something really obvious? Here is my benchmarking code: from Numeric import * import time # the numpy bit is messy, but the fastest i could come up with: # 3 element window, 4*row+2*row+row, to make integers from # 3 bit binaries. 1<< converts to 8 bit place, # &rule checks rule number for membership, # not_equal changes any number !=3D to zero to 1 def do_ca(w,h,rule): # make zeros array,set a[0] middle element to 1 to seed a =3D zeros((h,w)) a[0,w/2] =3D 1 res =3D [] for i in range(h-1): r =3D a[i] r2 =3D a[i+1] not_equal((1<<(4*r[:-2]+2*r[1:-1]+r[2:])&rule),0, r2[1:-1]) not_equal((1<<(4*r[-1]+2*r[0]+r[1])&rule),0, r2[0:0]) not_equal((1<<(4*r[-2]+2*r[1]+r[0])&rule),0, r2[-1:]) # uncomment next line and return res to get list for # drawPointList(res): # [res.append([x,i]) for x in nonzero(r2)] return a def timeIt(num): t1 =3D time.clock() for i in range(num): do_ca(1000,1000,90) t2 =3D time.clock() print t2 - t1 |
From: Alex T. <al...@tw...> - 2005-09-27 23:07:34
|
Andrew P wrote: > Hello, > > I have a program that spits out an array like: > > [[1 1 1 1 0] > [1 1 1 0 0] > [0 1 0 0 0] > [0 0 1 0 1] > [1 1 0 0 0]] > > Does anybody have a suggestion about the quickest way to draw this? > > I'm really very new at this. I'm just trying to avoid looping over > each element in the array to create a new array with RGB values, since > I want to have this animate as it draws, and scroll. This is for > cellular automata, in case anybody cares :) > How quickly do you need to draw it ? (And is 100x100 a realistic size limit, or do you need bigger ?) I tried a very simple loop as you described (see code below) and it took around 0.07 seconds to draw it on my 2-3 year old laptop (actually, to erase the previous set and draw a new set of points). You could probably optimize this significantly by drawing only those points which have changed rather than drawing all the previous set (to erase them) and then all the new set. But I'd recommend not optimizing it until (or unless) you have proven that you need to - try it the simple way first, and see whether optimization is needed or not. > I saw the drawPointList method, but I don't see a way to get from a > 2D array to a what looks like a list of x,y pairs? Is that what it > wants? Something like [[0,1],[0,2],[0,4]] instead of [0,1,1,0,1]? > Either way, that doesn't seem like a very direct method coming from an > array, but I could be way off here. I don't see a way to quickly get > to that point tho. > You probably don't want points - I think this would likely be too small so each individual point would be barely visible. So this sample code uses rectangles (I set the size to be 4 pixels). This is only the relevant snippet - but hopefully the context is clear enough (but let me know if you'd like the whole example and I'll send it to you directly - but note it's been adapted from another similar experiment I did, so has quite a bit of cruft in it ...) (first generate random points, then erase prior set, then draw new set)) > start = time.clock() > l2d = [] > for i in range(K): > line = [] > for j in range(K): > line.append(random.randint(0,1)) > l2d.append(line) > print "generate", K, "took", time.clock()- start > > start = time.clock() > pens = [] > self.components.bmpCanvas.freeze() > self.components.bmpCanvas.drawRectangleList(self.rects, > self.whitepens) > > self.rects = [] > pens = [] > self.whitepens = [] > siz = 4 > for i in range(K): > for j in range(K): > if l2d[i][j]: > self.rects.append( (siz*i, siz*j, siz, siz) ) > pens.append(self.basicpen) > self.whitepens.append(self.whitepen) > self.components.bmpCanvas.drawRectangleList(self.rects, pens) > self.components.bmpCanvas.thaw() > next = time.clock() > > print "Took ", next-start -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.6/111 - Release Date: 23/09/2005 |
From: Andrew P <gr...@gm...> - 2005-09-27 17:02:14
|
Hello, I have a program that spits out an array like: [[1 1 1 1 0] [1 1 1 0 0] [0 1 0 0 0] [0 0 1 0 1] [1 1 0 0 0]] Does anybody have a suggestion about the quickest way to draw this? I'm really very new at this. I'm just trying to avoid looping over each element in the array to create a new array with RGB values, since I want to have this animate as it draws, and scroll. This is for cellular automata, i= n case anybody cares :) I've tried this in the debugger shell with a 100x100 array: >>>img =3D wx.EmptyImage(100,100) >>>img.SetData(a.tostring()) Traceback (most recent call last): File "<input>", line 1, in ? File "C:\Python24\Lib\site-packages \wx-2.6-msw-unicode\wx\_core.py", line 2652, in SetData return _core_.Image_SetData(*args, **kwargs) ValueError: Invalid data buffer size. I saw the drawPointList method, but I don't see a way to get from a 2D arra= y to a what looks like a list of x,y pairs? Is that what it wants? Something like [[0,1],[0,2],[0,4]] instead of [0,1,1,0,1]? Either way, that doesn't seem like a very direct method coming from an array, but I could be way off here. I don't see a way to quickly get to that point tho. Thanks for any help, Andrew |
From: Phil E. <ph...@li...> - 2005-09-27 09:58:42
|
On Tue, 2005-09-27 at 08:52 +0200, Thies Thate wrote: > It seems that the PythonCard software has been installed in the wrong > directories. > > Is there someone who can help me out? > That's my fault. I thought I'd posted an updated PythonCard RPM for Mandrake 10.2 on my web site, but it would appear not. I'll update the page after I've sent this reply, please check here: http://www.linux2000.com/pythoncard.html And you'll be able to download an updated RPM shortly. I'll upload the latest versions to the project page on sourceforge at the same time. > Thanks, Thies Thate > > > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or your very > own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users -- Phil Edwards Brighton, UK |
From: Thies T. <mj...@pl...> - 2005-09-27 06:52:08
|
Hi everybody, I'm reading the Wrox book Beginning Python and I like to use the Pythoncard editor on Mandrake 10.2. Following the installation instructions of PythonCard I installed first the newest wxpython for mandrake 10.2 After that I installed Pythoncard for Mandrake (10.1 because there is no 10.2 version) I can find the "minimal" application, but nothing starts. I found the following place for the config.txt /usr/lib/python2.3/site-packages/PythonCard/pythoncard_config.txt but mandtrake 10.2 uses from python 2.4 in /usr/bin/python2.4 etc. It seems that the PythonCard software has been installed in the wrong directories. Is there someone who can help me out? Thanks, Thies Thate |
From: Andy T. <an...@ha...> - 2005-09-24 09:13:48
|
Kpiwara De X-nelo wrote: > Hi, I'm new here and i'm sure this doubt is pretty simple but I can't solve > I installed everything and the following message keeps showing > -------------------------------------------- > > Traceback (most recent call last): > File "/usr/share/PythonCard/samples/minimal/minimal.py", line 8, in ? > from PythonCard import model > File "/usr/lib/python2.3/site-packages/PythonCard/model.py", line 24, in ? > from wxPython.wx import wxPySimpleApp, wxFrame, wxMessageDialog, > wxICON_EXCLAMATION, wxOK, wxVERSION_STRING > File > "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/__init__.py", > line 10, in ? > import _wx > File > "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/_wx.py", > line 3, in ? > from _core import * > File > "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/_core.py", > line 22, in ? > wxNOT_FOUND = wx._core.NOT_FOUND > AttributeError: 'module' object has no attribute 'NOT_FOUND' > -------------------------------------------- > > Any ideas ? Thanks Which versions of Python, PythonCard and wxPython are you using? Which operating system are you running? Regards, Andy -- -------------------------------------------------------------------------------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |
From: Kpiwara De X-n. <kp...@gm...> - 2005-09-23 02:09:06
|
Hi, I'm new here and i'm sure this doubt is pretty simple but I can't solve I installed everything and the following message keeps showing -------------------------------------------- Traceback (most recent call last): File "/usr/share/PythonCard/samples/minimal/minimal.py", line 8, in ? from PythonCard import model File "/usr/lib/python2.3/site-packages/PythonCard/model.py", line 24, in ? from wxPython.wx import wxPySimpleApp, wxFrame, wxMessageDialog, wxICON_EXCLAMATION, wxOK, wxVERSION_STRING File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/__init_= _.py", line 10, in ? import _wx File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/_wx.py"= , line 3, in ? from _core import * File "/usr/lib/python2.3/site-packages/wx-2.6-gtk2-unicode/wxPython/_core.p= y", line 22, in ? wxNOT_FOUND =3D wx._core.NOT_FOUND AttributeError: 'module' object has no attribute 'NOT_FOUND' -------------------------------------------- Any ideas ? Thanks |
From: Alex T. <al...@tw...> - 2005-09-12 21:48:27
|
A rather long time ago (over a month ago), I said that I was working on a Sudoku Solver in PythonCard. I got stuck on a very difficult piece (writing the documentation). But today I saw a mention in "Daily Python-URL" (http://www.pythonware.com/daily/ ) of a simple text-based Sudoku solver (with somewhat different aims than mine), and that prompted me to finish it off. I did make a couple of tiny tweaks to the code, but I don't think I had any known bugs waiting (though there are a few enhancements I have in mind) - it was literally just the readme.txt that needed written. You can now find it at http://www.tweedly.net/Python/ Would this be worth adding to the samples ? For convenience, the readme is included here: Sudoku Solver can solve, or help you solve, Sudoku puzzles. The rules of Sudoku are very simple: - each digit 1-9 must appear exactly once in each row, column or 3x3 square Solving a puzzle. ================= The basic step to solve a puzzle is to select a value for a square. If you click in a square which has only one possible value available, that square will be coloured in, and that value is removed from all the other squares in the same row, column and 3x3 square (because it has now been assigned to the square you clicked in, it cannot be also put in the other squares in the same row, column and 3x3 square). If there are still multiple values possible for the square you click in, you will be presented with a pop-up menu of the possible values. Selecting any one of these will assign that value to the square (as above). Of course, you can also choose to not select on of the values, but releasing the mouse button while outside the pop-up menu. When you assign a value like this, the "mechanical" work of removing that value from the row, column and 3x3 square is done for you. Note that the status bar at the bottom of the window will show the number of possible combinations left: this will decrease as the solution progresses, and should eventually reach 1. There are three buttons which further automate the solving of a puzzle. Two of these (Singles and Soles) implement the two basic solution strategies, while the third (Solve it) simply applies the two strategies in turn until it succeeds (or goes as far as it can). Singles. -------- Any square for which there is only a single remaining value allowed is called a "single". Obviously, the initial values assigned as part of the puzzle definition are one example of this. The "single" value can be assigned to that square, and then that digit can be eliminate from the other squares in the same row, the same column and the same 3x3 square. This elimination of values may generate additional "singles" - they are not immediately taken, but clicking the button again will do them. Soles. ------ There may be only one square in a row which can still contain one of the digits, and this will be called the "sole" place that digit can go. Note this square may not be a "single" - it may have any number of still-valid possibilities, but if a particular digit can only be in the one place in that row, then it can be assigned as the "sole" place for it to go. Obviously, this can be applied to columns, and to 3x3 squares as well. Solve It -------- As we said above, this simply applies each of the two methods (Singles and Soles) above in turn, until neither produces any progress. There are three further buttons for use in solving puzzles. Blank ----- This produces a new, blank puzzle (i.e. equivalent to selecting File / New from the menu). Undo and Redo ---- ---- These are fairly self-explanatory - each click will undo (or redo) one step of the solution so far. Simple, Moderate and Complex Puzzles. ==================================== The four built-in puzzles are in order of simple to more difficult. You will find that many puzzles, like the first three here, can be solved simply by applying the strategies described above (either by clicking the buttons, or more satisfyingly by working through the puzzle one square at a time). However, some puzzles, such as the fourth built-in example, will not be fully resolved by using these techniques. While there are other analytical methods possible, the usual method to tackle these is simply to "postulate" (i.e. guess !!) one of the remaining values and see whether that leads to a solution or not. Well constructed Sudoku puzzles should have only a single solution, so this method will work. The easiest way to use this Sudoku Solver to do this is to simply choose the top, left square which still has multiple values possible, and do a trial assignment of the first value to it. Then click on "Solve it", and see what happens. If this value-assignment is incorrect, it will usually lead to some square(s) having no possible values left, and it (they) will be coloured bright red, so will be easy to spot. You can then click "Undo" multiple times, until you reach the point at which you made the guess. Then try the next possible value, and again click "Solve it". If the assignment is correct, then clicking "Solve it" will usually lead to a complete solution. Occasionally, the first guessed value will lead to neither a complete solution nor a complete conflict. In this case, you may need to move on to the next square which is not yet decided, and make a guess there. But do make sure that you remember to click on "Solve it" (or that you do the equivalent effort yourself) or you risk the possibility of not detecting the complete conflict or solution. (I have not actually found a puzzle that requires this multi-step postulation, but it's theoretically possible - if you do find one, please send it to me.) Defining or selecting a puzzle. =============================== A puzzle definition sets the initial values for some of the squares assignments. There are four puzzles built-in, and you can add as many new puzzles as you like. The quickest way to create a new puzzle is to edit a text definition file, and the solve that puzzle by selecting File / Open from the menu. The format for these files is simple; each row of the puzzle is a line in the file, each character is a single square, containing either a digit or 'x'. Extra spaces or blank lines are ignored. So the file to define the first built-in puzzle could look like: 98x 354 xxx 41x xx2 8xx x32 x1x 7xx 29x 1x5 xxx xxx x6x xxx 643 xx7 21x xxx 8xx x2x x5x x2x 6x7 xxx x3x x9x You can also create a puzzle by starting with a blank puzzle (i.e. immediately after starting the program, or by clicking the "Blank" button), then specifying values for your initial squares (by clicking in a square, then selecting the value from the pop-up menu), and finally selecting menu File / Save as ... and storing the puzzle definition in a file. You could also add more 'built-in' puzzles using the resource editor, by adding invisible buttons (similar to P1, P2, P3 P4) and adding menu entries (similar to File / Puzzle1 (the actual puzzle definition goes in the "userdata" of the invisible buttons). You can save a puzzle at any time, using the File / Save As .... menu selection. This will save the puzzle in the format described above, i.e. the only info saved is which squares have a single possible value assigned. All other squares will be simply marked as 'unknown' so if you later re-open this puzzle, you will be in an equivalent position, but will not see exactly the possibilities as you had seen before saving the puzzle state. The File / Save menu item is currently disabled, because it rarely, if ever, makes sense to save the current state so as to overwrite the state in the file. Further options =============== The two buttons at the bottom of the window give you further options on how much help you are given. Toggling both of these will let you solve the puzzle with no help at all - equivalent to solving it on paper, but without any easy way to mark-up your partial solutions or ideas. Hide Undecided -------------- Normally, any square for which there are multiple values still possible will show all of those choices (and only those choices). [Remember that until you have assigned a value to a square (and the square background has been coloured in), the assignment has not happened, so even though there is only a single possible value showing, that value will continue to be available in the other squares in the row, column and 3x3 square).] Toggling this button down will hide the multiple values in such undecided squares (but if you click in the square, the pop-up menu will present only the valid choices). Hide choices ------------ This controls which values are presented in the pop-up menu; when it is toggled, all values (1-9) are in the menu - whereas in the other case, only the values known to be valid are shown. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 10/09/2005 |
From: Bryan M. <bmu...@gm...> - 2005-09-08 04:56:37
|
Hmmm, on windows it doesn't even give me a side-scroll when a list item is too wide for the window. Anyone know how to at least get a scroll bar for that? Am I explaining myself well enough? Thanks, Bryan On 9/6/05, Bryan Murdock <bmu...@gm...> wrote: > Is it possible to word wrap list items so you don't have to > side-scroll to read a long item? >=20 > Bryan > |
From: Bryan M. <bmu...@gm...> - 2005-09-07 05:22:41
|
Is it possible to word wrap list items so you don't have to side-scroll to read a long item? Bryan |
From: <gre...@gm...> - 2005-09-04 16:37:22
|
>=20 >=20 > What are the results of using win32gui.BringWindowToTop(self.myHwnd)? > Regards, > Roger >=20 I get no errors from using that, but it doesn't bring it to the top against= =20 any other windows. The other method did work for the windows console and=20 outlook, but not for anything else. -Greg |
From: Kevin A. <al...@se...> - 2005-09-04 16:10:14
|
On Sep 4, 2005, at 4:10 AM, Alex Tweedly wrote: > Ronald Oussoren wrote: > Thanks Ronald. I hadn't spotted that this was still being cc'ed to > pythonmac-sig - so extra thanks for that. > >> >> I haven't followed this discusion upto now, but do you use py2app to >> build the application bundle on OSX? py2app places all .py/.pyc files >> into a zip file, resources are outside of the zip file. >> > No, these problems are also being seen within the IDE, so it's not an > app/bundle problem. > >> BTW. do you know about setuptools? It contains a generic API for >> dealing with resource files. >> > Yes, and that looks like a promising way to do this in the future. > (though it increases the dependencies). > But this code has existed and worked for a couple of years now, it's > important we know what's going wrong with it in case there are other > (less obvious) things that are going to fail for the same reasons. > >>> So - that's the background. >>> >>> Brad sent the debug output from the first case above (before >>> Kevin's suggested change), and also reported that the problem >>> persisted after the change. So it looks likely that it's a Python >>> bug. The Python docs are very sparse on what sys.modules should do. >> >> >> I'd say it is unlikely to be a bug in Python :-) >> > So would I - but the evidence up till this email all pointed that way > - and since this is (perhaps) an unusual use of the sys.modules info, > it seems just possible. > >>> >>> I'd like to see a simple test output which is independent of >>> PythonCard. >>> >>> < snip > >> >> >> For what it's worth: >> >> Python 2.3.5 (#1, Mar 20 2005, 20:38:20) >> [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> from mmm import myFile >> >>> myFile.myClass.__module__ >> 'mmm.myFile' >> >>> myFile.__file__ >> 'mmm/myFile.pyc' >> >>> sys.modules[myFile.myClass.__module__].__file__ >> 'mmm/myFile.pyc' >> >> and: >> Python 2.4.1 (#1, Aug 23 2005, 21:38:15) >> [GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import sys >> >>> from mmm import myFile >> >>> myFile.myClass.__module__ >> 'mmm.myFile' >> >>> myFile.__file__ >> 'mmm/myFile.py' >> >>> sys.modules[myFile.myClass.__module__].__file__ >> 'mmm/myFile.py' >> > Thanks again for that. (Not quite was I was hoping for :-), but very > valuable info). > > So we now know this simplest case works as expected - and the rather > complex case within PythonCard doesn't. > > It should be straightforward (if somewhat tedious) to narrow down the > differences until we find where the difference is. But that's not the > kind of debugging we can do via email on a list (or two!!), so I'm > hoping a PythonCard / Mac user can take it from there (or will contact > me off-list and we can work on narrowing it down). > > -- > Alex Tweedly http://www.tweedly.net I expect the problem has to do with relative paths. For some reason Python 2.4.1 is behaving different from 2.3 on the Mac as well as 2.3.x and 2.4.x versions on Windows and Linux. The reason why PythonCard tickles this problem is likely due to one or more lines in model.py. In particular, at the top there is a try/except block with the following line that was added as a fix for relative paths that would show up in earlier versions of Python when the module was imported: sys.path[0] = os.path.abspath(sys.path[0]) There was a discussion on python-dev quite a while ago that led to this line of code being used to prevent relative path ambiguity with the module path regardless of how the application changes its working directory. Here's an example run in the shell on the Mac with Python 2.3 (Panther). >>> import sys >>> sys.path[0] '' >>> import os >>> sys.path[0] = os.path.abspath(sys.path[0]) >>> sys.path[0] '/Users/kea/python/PythonCard' PythonCard does an explicit os.chdir later to the starting script directory to standardize behavior of apps regardless of where they were started from as well as simplify using support files, including modules that are in the application directory or sub-directories. self.applicationDirectory = util.dirname(os.path.abspath(sys.argv[0])) # always run in the app's directory os.chdir(self.applicationDirectory) Both of these bits of code, or equivalent in the case of the chdir above need to be part of a test prior to the path check for __file__. Since this is a relative path bug we're tracking down, it is quite possible that with Python 2.4.1 on the Mac you could get different results depending on whether you are running the script from the same directory you are working from in the shell, that was the reason for the sys.path[0] workaround in the first place. ka |
From: Andy T. <an...@ha...> - 2005-09-04 12:34:16
|
Martinez, Miguel (Amermex) wrote: > I=92m searching in the archives of this list for answers about my probl= em=20 > but maybe somebody can give me a hand. >=20 > I=92m trying to build a small application just to run a select statemen= t=20 > on an oracle database an show the results in a grid. I=92d already read= =20 > the wxgrid manual and wxPyGrid documentation, I=92d see the dbBrowser2=20 > code and used some pieces from it but I can=92t get it working. >=20 > =20 >=20 > This is the code I have, I changed some database =93secrets=94 >=20 [snip] >=20 Sorry it has taken so long to reply. Are you still having this problem?=20 If you are, what error messages are you seeing? Or what is happening=20 that you don't expect? Can you use the dbBrowser2 sample to connect to your database and=20 display your data? Regards, Andy --=20 -------------------------------------------------------------------------= ------- From the desk of Andrew J Todd esq - http://www.halfcooked.com/ |
From: Roger E. <ro...@er...> - 2005-09-04 12:14:10
|
Gregory Piñero wrote: > I am getting this error: > > Traceback (most recent call last): > File "C:\Python23\lib\site-packages\PythonCard\widget.py", line 402, > in _dispa > tch > handler(background, aWxEvent) > File "C:\Documents and Settings\Gregory\My Documents\Get New Great > Job\JobAppl > ierMarkII\job_applier_markII.py", line 271, in on_Start_timer > win32gui.SetForegroundWindow(self.myHwnd) > pywintypes.error: (0, 'SetForegroundWindow', 'No error message is > available') > > Though it does seem to be putting my window above some windows but not > others. So maybe it's partly working? > > -Greg > > > > Here's the actual code I'm using if you're curious: > > def _MyCallback( hwnd, extra ): > extra.append(hwnd) > > def find_my_hwnd(title): > windows = [] > win32gui.EnumWindows(_MyCallback, windows) > j = 0 > winDict = {} > for i in windows: > if win32gui.IsWindowVisible(i): > if title in win32gui.GetWindowText(i): > return i > return None > > Then the pythonCard initialize routine calls: > self.myHwnd=find_my_hwnd(self.title) > > Then I have a timer function going like this: > def on_Start_timer(self, event): > if self.menuBar.getChecked('menuOptionsStayOnTop'): > win32gui.SetForegroundWindow(self.myHwnd) > What are the results of using win32gui.BringWindowToTop(self.myHwnd)? Regards, Roger |
From: Alex T. <al...@tw...> - 2005-09-04 11:10:01
|
Ronald Oussoren wrote: Thanks Ronald. I hadn't spotted that this was still being cc'ed to pythonmac-sig - so extra thanks for that. > > I haven't followed this discusion upto now, but do you use py2app to > build the application bundle on OSX? py2app places all .py/.pyc files > into a zip file, resources are outside of the zip file. > No, these problems are also being seen within the IDE, so it's not an app/bundle problem. > BTW. do you know about setuptools? It contains a generic API for > dealing with resource files. > Yes, and that looks like a promising way to do this in the future. (though it increases the dependencies). But this code has existed and worked for a couple of years now, it's important we know what's going wrong with it in case there are other (less obvious) things that are going to fail for the same reasons. >> So - that's the background. >> >> Brad sent the debug output from the first case above (before Kevin's >> suggested change), and also reported that the problem persisted >> after the change. So it looks likely that it's a Python bug. The >> Python docs are very sparse on what sys.modules should do. > > > I'd say it is unlikely to be a bug in Python :-) > So would I - but the evidence up till this email all pointed that way - and since this is (perhaps) an unusual use of the sys.modules info, it seems just possible. >> >> I'd like to see a simple test output which is independent of >> PythonCard. >> >> < snip > > > > For what it's worth: > > Python 2.3.5 (#1, Mar 20 2005, 20:38:20) > [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> from mmm import myFile > >>> myFile.myClass.__module__ > 'mmm.myFile' > >>> myFile.__file__ > 'mmm/myFile.pyc' > >>> sys.modules[myFile.myClass.__module__].__file__ > 'mmm/myFile.pyc' > > and: > Python 2.4.1 (#1, Aug 23 2005, 21:38:15) > [GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import sys > >>> from mmm import myFile > >>> myFile.myClass.__module__ > 'mmm.myFile' > >>> myFile.__file__ > 'mmm/myFile.py' > >>> sys.modules[myFile.myClass.__module__].__file__ > 'mmm/myFile.py' > Thanks again for that. (Not quite was I was hoping for :-), but very valuable info). So we now know this simplest case works as expected - and the rather complex case within PythonCard doesn't. It should be straightforward (if somewhat tedious) to narrow down the differences until we find where the difference is. But that's not the kind of debugging we can do via email on a list (or two!!), so I'm hoping a PythonCard / Mac user can take it from there (or will contact me off-list and we can work on narrowing it down). -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005 |
From: Ronald O. <ron...@ma...> - 2005-09-04 09:18:42
|
On 3-sep-2005, at 14:38, Alex Tweedly wrote: > cat...@in... wrote: >> Yes, Alex, you're right. It was a supposed bug when I opened the >> thread, so the subject line was quite good at the moment. >> Later it became a bit obscure ;-) > OK - as long as you didn't think anyone was doubting that it was a > bug .... >>> Something appears to have changed wrt the path that Python's >>> sys.modules reports for imported files. >>> As far as I know, no-one has yet verified for sure whether it is >>> a Python bug or merely a platform-specific change that Pythoncard >>> will need to adjust for. (Nor do I know how we'll be able to >>> adjust - but I'm hoping that some of the PythonCard / Mac users >>> are investigating ....) >> That python user could be me ! Alex, would you discuss a bit more >> about this Python issue ? > Sure, I'll talk about it some, and maybe try to distill it down to > a simple small program that would be easy to try out. > But first I'll give a few disclaimers. > - I was totally unaware of this part of the code until this topic > came up > - I'm not a Python details kind of guy > - I don't have, or have access to, a Mac > > (So if Kevin has to come along and correct anything I say - don't > be too surprised). >> sys.modules reportings about the imported files has changed ? >> Since when ? Does this affect the Apple installed python or the >> "third parties" ones ? > No real idea since when. First guess would be between Python > 2.3.something and Python 2.4.something. > > I have a vague idea that Apple installed python is 2.3, so it > shouldn't be affected (but that's only a guess). > > The issue is how PythonCard finds the resource files that go along > with a Python source file. By default, they live in the same > directory as the source file, and have an extra ".rsrc" appended to > the base name (before the extension) - thus a source file xyz.py > would have a resource file xyz.rsrc.py > > PythonCard allows for various alternatives (language specific > resource files, platform specific files, no file but an internal > dictionary, etc.) and these make the code somewhat harder to > follow. But if you ignore all those, the essence of what PythonCard > does is > > 1. determine the full path name for the source file > 2. modify it as above > 3. read and eval() the resource file. > > In this case, the source file is not the application itself, but an > imported module. In the resourceEditor (in resourceEditor.py, in > fact), we do > > (before Kevin's suggested modification) > from modules.propertyEditor import PropertyEditor > .... > self.propertyEditorWindow = model.childWindow(self, > PropertyEditor) > > (or, after Kevin's suggested modification) > from modules import propertyEditor > .... > self.propertyEditorWindow = model.childWindow(self, > propertyEditor.PropertyEditor) > > (modules is a subdirectory within resourceEditor, propertyEditor.py > is a source file, PropertyEditor is a class within that file). > > So these two should be equivalent; Kevin suggested the change > because this is the only place within PythonCard that this form of > import is used - every other import is the second form (and there > was some hope that this change would help). > > I'll use the second version in this example below .... and probably > get some of the terminology wrong. > > When you call model.childWindow, you pass in the class you want - > i.e. propertyEditor.PropertyEditor > childWindow() then derives the filename, splits off the extension, > adds in the .rsrc.py and tries to read that file (remember I'm > skipping over the internationalization part ...) > > So it does [ frameClass is the class wanted ] > > filename = sys.modules[frameClass.__module__].__file__ > ..... > base, ext = os.path.splitext(filename) > filename = internationalResourceName(base) > rsrc = resource.ResourceFile(filename).getResource() I haven't followed this discusion upto now, but do you use py2app to build the application bundle on OSX? py2app places all .py/.pyc files into a zip file, resources are outside of the zip file. BTW. do you know about setuptools? It contains a generic API for dealing with resource files. > > > So - that's the background. > > Brad sent the debug output from the first case above (before > Kevin's suggested change), and also reported that the problem > persisted after the change. So it looks likely that it's a Python > bug. The Python docs are very sparse on what sys.modules should do. I'd say it is unlikely to be a bug in Python :-) > > I'd like to see a simple test output which is independent of > PythonCard. > > 1. Create a test directory > mine is called C:/python/projects/modulestest > > 2. create a subdirectory called "mmm" (calling it "modules" was > confusing me) > > 3. create a file within that subdirectory called myFile.py > containing >> class myClass: >> def init(): >> pass > 4. create another tile in that subdirectory (to make it a package) > called __init__.py containing >> # turn modules into a package > (note the name is underscore underscore i n i t underscore > underscore . p y ) > > 5. cd to the main test directory >> cd c:\python\projects\modulestest > 6. run python, and do >> import sys >> from mmm import myFile >> myFile.myClass.__module__ >> sys.modules[myFile.myClass.__module__].__file__ > and see what the output is. For what it's worth: Python 2.3.5 (#1, Mar 20 2005, 20:38:20) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> from mmm import myFile >>> myFile.myClass.__module__ 'mmm.myFile' >>> myFile.__file__ 'mmm/myFile.pyc' >>> sys.modules[myFile.myClass.__module__].__file__ 'mmm/myFile.pyc' and: Python 2.4.1 (#1, Aug 23 2005, 21:38:15) [GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> from mmm import myFile >>> myFile.myClass.__module__ 'mmm.myFile' >>> myFile.__file__ 'mmm/myFile.py' >>> sys.modules[myFile.myClass.__module__].__file__ 'mmm/myFile.py' > > It *should* be the path name to the file .... > <screen.PNG> > > > > This gives the same result on Python 2.4.1 on Windows. > I'd like to see the equivalent of this on each of Python 2.3 and > 2.4 on Mac. > > Then we'd know what the next step might be ... :-) > > -- Alex Tweedly http://www.tweedly.net > <screen.PNG> > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: > 31/08/2005 > _______________________________________________ > Pythonmac-SIG maillist - Pyt...@py... > http://mail.python.org/mailman/listinfo/pythonmac-sig > |
From: <gre...@gm...> - 2005-09-04 03:05:13
|
I am getting this error: Traceback (most recent call last): File "C:\Python23\lib\site-packages\PythonCard\widget.py", line 402, in=20 _dispa tch handler(background, aWxEvent) File "C:\Documents and Settings\Gregory\My Documents\Get New Great=20 Job\JobAppl ierMarkII\job_applier_markII.py", line 271, in on_Start_timer win32gui.SetForegroundWindow(self.myHwnd) pywintypes.error: (0, 'SetForegroundWindow', 'No error message is=20 available') Though it does seem to be putting my window above some windows but not=20 others. So maybe it's partly working? -Greg Here's the actual code I'm using if you're curious: def _MyCallback( hwnd, extra ): extra.append(hwnd) def find_my_hwnd(title): windows =3D [] win32gui.EnumWindows(_MyCallback, windows)=20 j =3D 0 winDict =3D {} for i in windows: if win32gui.IsWindowVisible(i): if title in win32gui.GetWindowText(i): return i return None Then the pythonCard initialize routine calls: self.myHwnd=3Dfind_my_hwnd(self.title) Then I have a timer function going like this: def on_Start_timer(self, event): if self.menuBar.getChecked('menuOptionsStayOnTop'): win32gui.SetForegroundWindow(self.myHwnd) |
From: Alex T. <al...@tw...> - 2005-09-03 12:38:49
|
No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.18/86 - Release Date: 31/08/2005 |
From: catonano\@inwind\.it <cat...@in...> - 2005-09-03 07:27:02
|
> >There's a current thread about this in the PythonCard-users group, > = >under the non-clear subject name: > > > > Re: update (was: Re:= [Pythoncard-users] supposed bug in > >PythonCard) > > > > > >Yes I = originated the thread. I found a bug in Pythoncard with python 2.4.1 and = wxPython 2.6.1.0 and > >PythonCard 0.8.1 > > > >It's not "supposed". I= t's a quite clearly a bug. > > > > > > > Adriano - > the only reas= on the subject line says "supposed bug ..." is because > that's the sub= ject line you chose for your initial posting to the > Pythoncard list o= n this topic :-) Yes, Alex, you're right. It was a supposed bug when I= opened the thread, so the subject line was quite good at the moment. =0D = Later it became a bit obscure ;-) > Something appears to have change= d wrt the path that Python's sys.modules > reports for imported files. = >As far as I know, no-one has yet verified > for sure whether it is= a Python bug or merely a platform-specific change > that Pythoncard wi= ll need to adjust for. (Nor do I know how we'll be > able to adjust - b= ut I'm hoping that some of the PythonCard / Mac users > are investigati= ng ....) That python user could be me ! Alex, would you discuss a b= it more about this Python issue ? sys.modules reportings about the imp= orted files has changed ? Since when ? Does this affect the Apple ins= talled python or the "third parties" ones ? Thanks! Bye Adriano =0A= =0A=0A=0A____________________________________________________________=0AL= ibero Flat, sempre a 4 Mega a 19,95 euro al mese! =0AAbbonati subito su h= ttp://www.libero.it=0A=0A |
From: Roger E. <ro...@er...> - 2005-09-03 00:21:31
|
Hi Greg, since you're apparently running on windows, maybe this may be of help: import win32gui, win32ui def _MyCallback( hwnd, extra ): extra.append(hwnd) windows = [] win32gui.EnumWindows(_MyCallback, windows) j = 0 winDict = {} for i in windows: if win32gui.IsWindowVisible(i): winDict[j] = i j += 1 win32gui.SetForegroundWindow(winDict[1]) # found this out by inspection # the key of the window on top try: fgwindow = win32ui.GetForegroundWindow() print fgwindow.GetWindowText() except: print "No window found on the ForeGround?!" I'm not very happy with this algorithm, but given my little knowledge of MS Windows and the very few times the exception is raised, it suffices in my case. Regards, Roger |