wxPython getPosition() limit
Hi, I've this big problem: I've an wx.ScrolledWindow object, which contains element. These elements have the event OnPaint that draw itself same objects. For drawing, each element call the method GetPosition(), which returns a tuple int. But, if I have the element 5000 that it must be designed at position x = 30 y = 4, this object cannot be designed in this location, but on x=30, x= 32767, because GetPosition() return a INT tuple. I note that this problem doesn't exists on Unix Platform ( wxPython installed on Fedora ), but on Windows this is a disaster! Someone have any idea? thx very much -- http://mail.python.org/mailman/listinfo/python-list
wxPython getPosition() limit
Hi, I've this big problem: I've an wx.ScrolledWindow object, which contains element. These elements have the event OnPaint that draw itself same objects. For drawing, each element call the method GetPosition(), which returns a tuple int. But, if I have the element 5000 that it must be designed at position x = 30 y = 4, this object cannot be designed in this location, but on x=30, x= 32767, because GetPosition() return a INT tuple. I note that this problem doesn't exists on Unix Platform ( wxPython installed on Fedora ), but on Windows this is a disaster! Someone have any idea? thx very much -- http://mail.python.org/mailman/listinfo/python-list
wxWindow GetPosition() bug???
Hi, I've found a strange behavior in method GetPosition() of wxWindow class ( and derived ). On windows, if you create a window object frame = wx.Frame(None, -1, "TESTING") and you set the position to: frame.SetPosition( (300, 45000) ) If you call method GetPosition, the result will be: frame.GetPosition() >>> (300, 32767) 32767 is the integer limit. Why GetPosition() returns this value??? and why on Unix Platform this problem was not found?? thx very much! bye -- http://mail.python.org/mailman/listinfo/python-list
SpinCtrl events problem
Hi, I've a problem with wx.SpinCtrl Here we go with my source code: import wx import traceback class TextPage(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "") box = wx.BoxSizer(wx.VERTICAL) self.spin = wx.SpinCtrl(self, -1) box.Add(self.spin) self.SetSizer(box) wx.EVT_SPINCTRL(self, self.spin.GetId(), self.spinCtrlEvent ) self.CenterOnScreen() def spinCtrlEvent(self, evt): pass print "ALL RIGHT" if __name__ == "__main__": app = wx.PySimpleApp(0) p = TextPage() p.Show() app.MainLoop() Now, my problem is the increment/decrement of self.spin value. The SpinCtrl object increment/decrement 1 unit at time. I must increment/decrement "n" unit at time, ex: 5,10,15,20 I've tried: def __init__(self): self.old_quantity = 0 def spinCtrlEvent(self, evt): if ( evt.GetInt() > self.old_quantity ): qta = self.old_quantity + 5 else: qta = self.old_quantity - 5 self.old_quantity = qta self.spin.SetValue( qta ) But here the process it goes in loop, because the SetValue SpinCtrl method regenerates the EVT_SPINCTRL event Any idea? Thanks very much -- http://mail.python.org/mailman/listinfo/python-list
wxNotebook color change
Hi ! this is my problem: I've a wxNotebook object, which contains 2 Panels. On up, there is TAB section, I have 2 tabs. I want to color the TAB section with ( for example ) red color. I've tried with SetBackgroundColour() for wxNotebook object and for 2 panel inside, but it doesn't works. why?? thx in advance! bye -- http://mail.python.org/mailman/listinfo/python-list
Re: wxNotebook color change
No no!!! Your example is OK, great! but is not my problem: If you set: frame.SetBackgroundColour(wx.RED) On unix, you can see that label "form1" and "form2" are grey, and others elements are red. But on Windows, on the same line of "form1" and "form2", the color is not red, but grey as labels. I want to color this space RED!!! Rob Wolfe wrote: > mardif wrote: > > Hi ! > > > > this is my problem: > > > > I've a wxNotebook object, which contains 2 Panels. > > On up, there is TAB section, I have 2 tabs. > > I want to color the TAB section with ( for example ) red color. > > > > I've tried with SetBackgroundColour() for wxNotebook object and for 2 > > panel inside, but it doesn't works. > > why?? > > Presumably you forgot to refresh window. Try this: > > > import wx > > app = wx.PySimpleApp() > > frame = wx.Frame(None, -1, "Notebook") > nb = wx.Notebook(frame, -1) > form1 = wx.Panel(nb, -1) > nb.AddPage(form1, "Form1") > form2 = wx.Panel(nb, -1) > form2.SetBackgroundColour(wx.RED) > nb.AddPage(form2, "Form2") > nb.SetSelection(1) > frame.Refresh() > frame.Show(True) > > app.MainLoop() > > > HTH, > Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Python memory deallocate
In python 2.5 this was resolved, ok, but i can't use any python version then 2.3.5. This project was initializated with this version, and now it can be dangerous change version, even because I use McMillan installer for compile e build an executable. So, my initial window is a "menu window", when i can choose, for example, upload foto for print, or create an object as PhotoAlbum. If i'will choose PhotoAlbum, it will allocate 200Mb. well! if i decide to abort this work, i will return to initial window. and if i will click in PhotoAlbum ago, the memory will increase to 350-400Mb. It's that!!! I don't understand why!!! when i abort the work the first time, i call app.Destroy() del app Why Python ( or GarbageCollector, or ) don't deallocate memory?? If it's not possibile, why python don't reuse the memory "cached"? thx a lot -- http://mail.python.org/mailman/listinfo/python-list
Re: Python memory deallocate
OK! i will test my app with python 2.5a2 thx -- http://mail.python.org/mailman/listinfo/python-list
open file with whitespaces
Hi guys. I've a very big big big problem: I've in my windows computer a file named cicciobello.html, located in c:\documents and settings\username\desktop\cicciobello.html. Now, I MUST open this file with os.spawn(os.P_WAIT , because I must wait the user cancel the explorer window, ok? And so, I write: import os os.spawnl(os.P_WAIT, "c:\programmi\internet explorer\iexplorer.exe", "c:\documents and settings\username\desktop\cicciobello.html") the python process don't fail, but explorer don't visualize correctly the file opened: i receive an "not found" error message. I've found that the whitespaces in file path are the problem. If you see to explorer address bar, you will find the address completely wrong... I've found no solution! Can you help me, please?? thx very very very much!!! -- http://mail.python.org/mailman/listinfo/python-list
Re: open file with whitespaces
OK OK GUYS I've found the solution: ( effectly, a friend of mine has found the solution ) import os os.spawnl(os.P_WAIT, "c:\programmi\internet explorer\iexplore.exe",'"C:\Documents and Settings\michele\Desktop\ciccio.html"','"C:\Documents and Settings\michele\Desktop\ciccio.html"') The secret are the ' simbols around arguments: ' "C:\Documents and Settings\michele\Desktop\ciccio.html" ' Without these, don't work! Very STRONG! bye and thx -- http://mail.python.org/mailman/listinfo/python-list
PIL problem with biprocessor hardware
Hi guys, I've a problem, but very big! So, i have a python/PIL application that manipulate images ( rotate, crop, save, etc etc ). If this application work on a PC mono-processor, I don't have any problems. If this application work instead on a PC bi-processor, the process elaborates an image "corrupted": I mean "corrupted" because: If I open this image with any image-viewer, it will show the image with background color on top blue, and on bottom green. Sometimes it can happen that somethings inside was wrong designed. If i open this image instead with GIMP, this message will shown: Corrupt JPEG data: 36 ( this value is not ever equal ) extraneous bytes before marker 0xd9 EXIF data will be ignored. This error don't has a procedure that will produce it. It's random. I've executed this application in a PC mono-processor, and it seems all ok ( 100% ), instead on a PC bi-processor sometimes don't work ( 90% ? ). Thx very much -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL problem with biprocessor hardware
OK, this is the code:
"""
image is the object instance of Image class which contains all
informations
"""
pil = Image.open( os.path.join( image.path,image.name ) )
if image.rotation_angle != 2:
try:
pil = pil.rotate( rotation_levels[image.rotation_angle]
)
except:
traceback.print_exc()
result = False
if ( image.cropped ):
box = [ float(image.cropX) , \
float(image.cropY) , \
(float(image.cropX)+float(image.cropW)), \
(float(image.cropY)+float(image.cropH))
]
try:
pil = pil.crop( box )
except:
traceback.print_exc()
if pil.size[0] < pil.size[1]:
try:
pil = pil.rotate( 90 )
except:
traceback.print_exc()
filtro_compressione = Image.BILINEAR
try:
pil =
pil.resize((image.realW,image.realH),filtro_compressione)
except:
traceback.print_exc()
if not pil.mode == 'RGB':
try:
pil = pil.convert('RGB')
except:
traceback.print_exc()
try:
pil.save( path, format="JPEG", quality=80 )
except Exception,e:
traceback.print_exc()
I think this is very normal.
It's NOT normal that don't work well on PC SMP processor...
not?
--
http://mail.python.org/mailman/listinfo/python-list
