Today's topic summary
Group: http://groups.google.com/group/wxpython-users/topics
- [No Subject] <#145043ef7602b025_group_thread_0> [1 Update]
- Why my TextCtl can get wx.EVT_TEXT event, but can not get
wx.EVT_TEXT_ENTER event <#145043ef7602b025_group_thread_1> [2 Updates]
- FileDialog: Can I inquire which wildcard was selected by the user?<#145043ef7602b025_group_thread_2>[2 Updates]
- wx.EVT_TEXT_URL <#145043ef7602b025_group_thread_3> [4 Updates]
- How to manually set the toggle state of wxpython platebutton<#145043ef7602b025_group_thread_4>[1 Update]
- How to reorder a wxWindowList obtained from GetChildren() function<#145043ef7602b025_group_thread_5>[1 Update]
- snappiness of wxPython apps <#145043ef7602b025_group_thread_6> [8
Updates]
- AcceleratorTable on OSX <#145043ef7602b025_group_thread_7> [2
Updates]
- how do expand window to show all tab labels by default?<#145043ef7602b025_group_thread_8>[1 Update]
- wx.html2 and CMD C on OSX <#145043ef7602b025_group_thread_9> [1
Update]
- How to hold further execution of sub frame until it is closed or
even is clicked? <#145043ef7602b025_group_thread_10> [1 Update]
- problems with changing backgoundcolour in button event function.
Also using sizer <#145043ef7602b025_group_thread_11> [1 Update][No Subject]<http://groups.google.com/group/wxpython-users/t/c02a57c84fc41c53>
Rill <luckrill@gmail.com> Mar 27 11:53PM +0800
When dclick image, I want to get "OnMouseLeftDClick ======" message.
But I always get "image on left dclick ------" message.
Please help me.#!/usr/bin/env python
# -*- coding: utf-8 -*-
# When dclick image, I want to get "OnMouseLeftDClick ======" message.import wx
import os
import sysreload(sys)
sys.setdefaultencoding("utf-8")
image_file = "Waterlilies.jpg"
BAD_IMAGE = -1class ImageView(wx.Window):
def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize,
style=wx.BORDER_SUNKEN
):
wx.Window.__init__(self, parent, id, (0, 0), (-1, 300), style=style)
self.maxWidth = 0
self.maxHeight = 0self.image = None
self.dark_bg = None
self.lite_bg = Noneself.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseLeftDClick)self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_PAINT, self.OnPaint)def OnEnterWindow(self, event):
print "On Enter Window -------"def OnLeaveWindow(self, event):
print "On Leave Window -------"def OnKeyUp(self, event):
key = event.GetKeyCode()
print "on key up ------: ", keyLevel = event.StopPropagation()
if (Level == 0):
Level = 1
event.ResumePropagation(Level)
event.Skip()def OnMouseLeftUp(self, event):
print "image on left up ------"
Level = event.StopPropagation()
if (Level == 0):
Level = 1
event.ResumePropagation(Level)
event.Skip()def OnMouseLeftDClick(self, event):
print "image on left dclick ------"
Level = event.StopPropagation()
if (Level == 0):
Level = 1
event.ResumePropagation(Level)
event.Skip()def SetValue(self, filename, rotate, enlarge):
if (filename):
self.image = wx.Image(filename, wx.BITMAP_TYPE_ANY)
else:
print "no file, try to clear"
self.image = None
self.famous_words == " "self.Refresh()
def SetImageObject(self, image_object):
if image_object:
self.image = image_object
self.Refresh()def SetZoomValue(self, value):
self.zoom_value = value
if self.maxWidth == 0:
self.maxWidth, self.maxHeight = self.GetSize()self.maxWidth = int(self.maxWidth * self.zoom_value)
self.maxHeight = int(self.maxHeight * self.zoom_value)self.SetVirtualSize((self.maxWidth, self.maxHeight))
self.SetScrollRate(20,20)def SetBackgroundMode(self, mode):
self.bg_mode = mode
self._updateBGInfo()def _updateBGInfo(self):
bg = self.bg_mode
border = self.border_modeself.dark_bg = None
self.lite_bg = Noneif border == ID_BOX_FRAME:
self.lite_bg = wx.BLACK_PENif bg == ID_WHITE_BG:
if border == ID_CROP_FRAME:
self.SetBackgroundColour('LIGHT GREY')
self.lite_bg = wx.WHITE_BRUSH
else:
self.SetBackgroundColour('WHITE')elif bg == ID_GREY_BG:
if border == ID_CROP_FRAME:
self.SetBackgroundColour('GREY')
self.lite_bg = wx.LIGHT_GREY_BRUSH
else:
self.SetBackgroundColour('LIGHT GREY')elif bg == ID_BLACK_BG:
if border == ID_BOX_FRAME:
self.lite_bg = wx.WHITE_PEN
if border == ID_CROP_FRAME:
self.SetBackgroundColour('GREY')
self.lite_bg = wx.BLACK_BRUSH
else:
self.SetBackgroundColour('BLACK')else:
if self.check_bmp is None:
self.check_bmp = GetCheckeredBitmap()
self.check_dim_bmp = GetCheckeredBitmap(rgb0='\x7F',
rgb1='\x66')
if border == ID_CROP_FRAME:
self.dark_bg = self.check_dim_bmp
self.lite_bg = self.check_bmp
else:
self.dark_bg = self.check_bmpself.Refresh()
def SetBorderMode(self, mode):
self.border_mode = mode
self._updateBGInfo()def OnSize(self, event):
event.Skip()
self.Refresh()def OnPaint(self, event):
dc = wx.PaintDC(self)
self.DrawImage(dc)def OnEraseBackground(self, evt):
if self.bg_mode != ID_CHECK_BG:
evt.Skip()
return
dc = evt.GetDC()
if not dc:
dc = wx.ClientDC(self)
rect = self.GetUpdateRegion().GetBox()
dc.SetClippingRect(rect)
self.PaintBackground(dc, self.dark_bg)def PaintBackground(self, dc, painter, rect=None):
if painter is None:
return
if rect is None:
pos = self.GetPosition()
sz = self.GetSize()
else:
pos = rect.Position
sz = rect.Sizeif type(painter)==wx.Brush:
dc.SetPen(wx.TRANSPARENT_PEN)
dc.SetBrush(painter)
dc.DrawRectangle(pos.x,pos.y,sz.width,sz.height)
elif type(painter)==wx.Pen:
dc.SetPen(painter)
dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.DrawRectangle(pos.x-1,pos.y-1,sz.width+2,sz.height+2)
else:
self.TileBackground(dc, painter, pos.x,pos.y,sz.width,sz.height)def TileBackground(self, dc, bmp, x,y,w,h):
"""Tile bmp into the specified rectangle"""
bw = bmp.GetWidth()
bh = bmp.GetHeight()
dc.SetClippingRegion(x,y,w,h)dx = x % bw
x = x - dx
w = w + dxdy = y % bh
y = y - dy
h = h + dytx = x
x2 = x+w
y2 = y+hwhile tx < x2:
ty = y
while ty < y2:
dc.DrawBitmap(bmp, tx, ty)
ty += bh
tx += bwdef DrawImage(self, dc):
"""must use one type image, pil or wx.image"""
wwidth,wheight = self.GetSize()
if self.maxWidth > 0:
wwidth = self.maxWidth
wheight = self.maxHeightimage = self.image
bmp = Noneiwidth = image.GetWidth() # dimensions of image file
iheight = image.GetHeight()xfactor = float(wwidth) / iwidth
yfactor = float(wheight) / iheightself.image_scale = 0
if self.image_scale == 0:
if xfactor < 1.0 and xfactor < yfactor:
self.image_scale = xfactor
elif yfactor < 1.0 and yfactor < xfactor:
self.image_scale = yfactor
else:
self.image_scale = 1.0
else:
if self.zoom_value > 0:
self.image_scale *= self.zoom_valueowidth = int(self.image_scale*iwidth)
oheight = int(self.image_scale*iheight)diffx = (wwidth - owidth)/2 # center calc
diffy = (wheight - oheight)/2 # center calcif not bmp:
if owidth!=iwidth or oheight!=iheight:
sc_image = sc_image = image.Scale(owidth,oheight)
else:
sc_image = image
bmp = sc_image.ConvertToBitmap()if image != BAD_IMAGE and image.IsOk():
self.PaintBackground(dc, self.lite_bg,
wx.Rect(diffx,diffy,owidth,oheight))
dc.DrawBitmap(bmp, diffx, diffy, useMask=True) # draw
the image to windowclass ImagePanel(wx.Panel):
def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.NO_BORDER ):
wx.Panel.__init__(self, parent, id, pos, size, style=style)
self.bs = wx.BoxSizer(wx.VERTICAL)
self.view = ImageView(self)
self.bs.Add(self.view, 1, wx.EXPAND)
self.SetSizer(self.bs)def SetValue(self, filename, rotate=0, enlarge=1): # display
the selected file in the panel
self.view.SetValue(filename, rotate, enlarge)def SetImageObject(self, image_object): # display the selected
file in the panel
self.view.SetImageObject(image_object)def SetZoomValue(self, value):
self.view.SetZoomValue(value)class Frame(wx.Frame):
"""Frame class, main window."""
def __init__(self):
wx.Frame.__init__(self, None, -1, "Image Change", size=(800, 600))
self.panel = wx.Panel(self)self.filename = None
self.listbox_curr_item = -1
self.tmp_mark = Truelabel_format = wx.StaticText(self.panel, -1, "Format", size=(60, -1))
list_close = wx.Button(self.panel, -1, label="Close")
self.listbox = wx.ListBox(self.panel, -1, (20, 20), (150,
460), "", wx.LB_EXTENDED)vbox_top = wx.BoxSizer(wx.HORIZONTAL)
self.image_view = ImagePanel(self.panel)
vbox_left = wx.BoxSizer(wx.VERTICAL)
vbox_change_format = wx.BoxSizer(wx.HORIZONTAL)
vbox_change_format.Add(label_format, 0, flag=wx.ALIGN_CENTER)
vbox_left.Add(self.image_view, 1, wx.EXPAND)
vbox_top.Add(vbox_left, 1, wx.EXPAND)
vbox_cmd = wx.BoxSizer(wx.VERTICAL)
vbox_listbox = wx.BoxSizer(wx.VERTICAL)
vbox_cmd.Add(list_close, 0, wx.ALIGN_CENTER)
vbox_listbox.Add(self.listbox, 0, wx.ALL|wx.EXPAND, border=1)
vbox_cmd_listbox = wx.BoxSizer(wx.HORIZONTAL)
vbox_cmd_listbox.Add(vbox_cmd, 0, flag=wx.ALIGN_CENTER)
vbox_cmd_listbox.Add(vbox_listbox, 0, flag=wx.ALIGN_CENTER)vbox_format = wx.BoxSizer(wx.HORIZONTAL)
vbox_format.Add(label_format, 0, flag=wx.ALIGN_CENTER)
vbox_right = wx.BoxSizer(wx.VERTICAL)
vbox_right.Add(vbox_cmd_listbox, 0, flag=wx.ALIGN_CENTER)
vbox_top.Add(vbox_right, 0, flag=wx.ALL|wx.EXPAND, border=2)self.panel.SetSizer(vbox_top)
self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseLeftDClick)
self.Bind(wx.EVT_BUTTON, self.OnClose, list_close)
self.Bind(wx.EVT_CLOSE, self.OnExit)
self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow)self.image_view.SetValue(image_file)
def OnMouseLeftUp(self, event):
print "on left up ======"def OnMouseLeftDClick(self, event):
print "OnMouseLeftDClick ======"def OnEnterButton(self, event):
"""Move mouse into the button area."""
print "enter button"
event.Skip()def OnLeaveButton(self, event):
print "button leave"
event.Skip()def OnEnterWindow(self, event):
print "OnEnterWindow"def OnSize(self, event):
print "main frame OnSize"def OnExit(self, event):
self.Destroy()
event.Skip()class App(wx.App):
"""Application class."""
def OnInit(self):
self.frame = Frame()
self.frame.Show(True)
self.SetTopWindow(self.frame)
return Truedef main():
app = App()
app.MainLoop()if __name__ == '__main__':
main()--
jiang zhixiangWhy my TextCtl can get wx.EVT_TEXT event, but can not get
wx.EVT_TEXT_ENTER event<http://groups.google.com/group/wxpython-users/t/1504583a50d55366>luckrill <luckrill@gmail.com> Mar 27 01:52AM -0700
My wx.SplitterWindow environment, TextCtl meet event issue.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Why TextCtl can get wx.EVT_TEXT event, but can not get
wx.EVT_TEXT_ENTER
eventimport wx
import wx.lib.scrolledpanel as scrolled
import os
import sysreload(sys)
sys.setdefaultencoding("utf-8")image_file = "Waterlilies.jpg"
class Frame(wx.Frame):
def __init__(self, index=0):
"""Create a Frame instance"""
wx.Frame.__init__(self, None, -1, "Image Show", size=(800, 600),
style=wx.DEFAULT_FRAME_STYLE)# Create split window
self.split = wx.SplitterWindow( self, -1, style=wx.SP_NOBORDER )
self.imgpanel = wx.ScrolledWindow( self.split, -1,
style=wx.NO_BORDER )
self.imgpanel.SetScrollbars( 50, 50, 20, 20 )
self.img = wx.StaticBitmap( self.imgpanel, -1 )imgVsizer = wx.BoxSizer( wx.VERTICAL )
imgHsizer = wx.BoxSizer( wx.wx.HORIZONTAL )
imgHsizer.Add( self.img, 1, wx.CENTER, 0 )
imgVsizer.Add( imgHsizer, 1, wx.CENTER, 0 )
self.imgpanel.SetSizer( imgVsizer )print "Create a Frame instance"
self.panel = wx.Panel(self.split, -1, style=wx.SP_NOBORDER)
self.split.SplitHorizontally ( self.imgpanel, self.panel, -40 )
self.filename = None
self.cmd_box = wx.BoxSizer(wx.HORIZONTAL)image_up = wx.Button(self.panel, -1, label=("Up"))
image_next = wx.Button(self.panel, -1, label=("Next"))
self.text_current_num = wx.TextCtrl(self.panel, -1, "", size=(80,
-1))self.cmd_box.Add(image_up, 0, wx.ALIGN_CENTER)
self.cmd_box.Add(image_next, 0, wx.ALIGN_CENTER)
self.cmd_box.Add(self.text_current_num, 0, wx.ALIGN_CENTER)
self.main_box = wx.BoxSizer(wx.VERTICAL)
self.main_box.Add(self.cmd_box, 0, wx.ALIGN_CENTER)
self.panel.SetSizer(self.main_box)#map event
self.Bind(wx.EVT_BUTTON, self.OnImageUp, image_up)
self.Bind(wx.EVT_BUTTON, self.OnImageNext, image_next)#imgpanel.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.img.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
self.img.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseLeftDClick)self.text_current_num.Bind(wx.EVT_TEXT, self.OnInputText)
self.text_current_num.Bind(wx.EVT_TEXT_ENTER, self.OnInputTextEnter)self.Bind(wx.EVT_CLOSE, self.OnExit)
self.Bind(wx.EVT_SIZE, self.OnSize)
filename = image_file
self.SetValue(filename, new=True)
# self.imgpanel.SetFocus()def OnKeyDown(self, event):
print "on key down ======"
key = event.GetKeyCode()
print "KeyPress: ", key
event.Skip()def OnKeyUp(self, event):
print "on key up ======"
key = event.GetKeyCode()
print "KeyPress: ", key
event.Skip()def OnMouseLeftUp(self, event):
print "image mouse left on up click =="def OnMouseLeftDown(self, event):
print "image mouse left on down click =="def OnMouseLeftDClick(self, event):
print "mouse left dclick"def KeyPress(self, event):
print "Key press ======"
key = event.GetKeyCode()
print "KeyPress: ", keydef OnEnterWindow(self, event):
print "On Enter Window"def OnLeaveWindow(self, event):
print "On Leave Window"def OnSize(self, event):
event.Skip()
self.Layout()def OnInputText(self, event):
print "OnInputText *"
event.Skip()def OnInputTextEnter(self, event):
print "OnInputTextEnter *"
event.Skip()def OnImageUp(self, event):
self.ImageUp()def ImageUp(self):
passdef OnImageNext(self, event):
passdef DrawImage(self, filename, rotate):
win_width, win_height = self.GetSize()
win_width -= 100
win_height -= 100
empty_image = wx.EmptyImage(win_width, win_height)
empty_image.Replace(0,0,0,255,255,255)
bmp = empty_image.ConvertToBitmap()
sz = (win_width,win_height)
self.img.SetSize( sz )
self.img.SetBitmap( bmp )
self.imgpanel.SetVirtualSize( sz )def SetValue(self, filename, rotate=0, new=False): # display the
selected file in the panel
if new == True:
self.ResetVal()
self.DrawImage(filename, rotate)li = filename.split(os.sep)
if len(li) > 0:
self.SetTitle(li[-1])
else:
self.SetTitle("")def ResetVal(self):
self.zoom_value = 1.0
self.image_scale = 0
self.win_zoom_value = 0def OnExit(self, event):
self.Destroy()def scale_size(self, s_width, s_height, to_width, to_height):
xfactor = float(to_width) / s_width
yfactor = float(to_height) / s_height
if xfactor < 1.0 and xfactor < yfactor:
scale = xfactor
elif yfactor < 1.0 and yfactor < xfactor:
scale = yfactor
else:
scale = xfactorowidth = int(scale*s_width)
oheight = int(scale*s_height)return (owidth, oheight)
class App(wx.App):
"""Application class."""
def OnInit(self):
self.frame = Frame()
self.frame.Show(True)
self.SetTopWindow(self.frame)
return Truedef main():
app = App()
app.MainLoop()if __name__ == '__main__':
main()luckrill <luckrill@gmail.com> Mar 27 07:34AM -0700
I found the reson: TextCtl need style=wx.TE_PROCESS_ENTER
thanksFileDialog: Can I inquire which wildcard was selected by the user?<http://groups.google.com/group/wxpython-users/t/57182c1ceafb2a77>
GRW <g.willgoose@telluricresearch.com> Mar 27 04:28AM -0700
I have a problem where I want to allow users to input files and I need
to
select the right input code for the file. Normally its OK to
differentiate
the different files types on the basis of extensions but sometimes
other
packages we use output data in different file formats but use the same
extension. For instance, many packages output files with .dat
extension but
the internals of the file are different from application to
application. I
thought I might be able to get round this by having a wildcard that
use the
drop down menu to differentiate the file types as'SURFER|*.dat|TOUGH2|*.dat'
where SURFER and TOUGH2 are both programs that output a .dat file with
essentially the same data in them but with different internal formats.My question: is there a way in FileDialog to inquire which of the
wildcard
filters was selected by the user (i.e. did they select SURFER or did
they
select TOUGH2) because I clearly can't use the extension of the
selected
file to differentiate. I've looked in the wxwidgets docs and can't
find
anything … so I suspect it can't be done but I thought I'd check here
first
before putting up a 2nd dialog when I need clarification of what
package
generated the file.Karsten Hilbert <Karsten.Hilbert@gmx.net> Mar 27 01:09PM +0100
> anything … so I suspect it can't be done but I thought I'd check
here first
> before putting up a 2nd dialog when I need clarification of what
package
> generated the file.You may want to look at the file content to find out.
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346wx.EVT_TEXT_URL<http://groups.google.com/group/wxpython-users/t/e6dcf0ac58e96f53>
Udgam Mehetre <uvmgr8@gmail.com> Mar 26 11:48AM -0700
Hello all!
I am using a wx.textctrl widget to display some urls. I want the url
to
open in a browser when the user clicks on the links. I read that
implementing wx.TE_RICH and wx.TE_AUTO_URL would let me achieve this
(click-able urls). I also binded the widget instance to an event, as
follows:>>OutputText=wx.TextCtrl(panel ,pos =(10,10),size=(700,300),
style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH|wx.TE_AUTO_URL)>>OutputText.Bind(wx.EVT_TEXT_URL,self.openurl)
Now, what happens is, if even the mouseover happens, this event is
triggered. I mean, if one just brings the cursor on the url, the event
is
called, instead of triggering when actual 'click' happens.
I am sure my implementation of the wx.EVT_TEXT_URL maybe the fault.
Hence
my question...where am I possibly wrong? What do I change to set it
right?Thanks in advance!
Regards,
Udgam Mehetre"Boštjan Mejak" <bostjan.galaxy@gmail.com> Mar 26 10:57PM +0100
Try using the self.
self.OutputText = wx.TextCtrl(.......)
and then here
self.OutputText.Bind(wx.EVT_TEXT_URL, self.openurl)uvmgr8 <uvmgr8@gmail.com> Mar 27 02:54PM +0530
Isnt the self.widget_instance about scope of the widget? My problem is
that
the wx.EVT_TEXT_URL doesn't work (or I dont know how it works) as I
need it
to work. Whlie the url is displayed as hyperlink, the wx.EVT_TEXT_URL
triggers even if I drag my mouse over the hyperlink. I need it to do so
only if I click on the hyperlink.--
*Udgam Mehetre**" Imagination is the only weapon in the war against reality.**"*
"Boštjan Mejak" <bostjan.galaxy@gmail.com> Mar 27 12:05PM +0100
def openurl(self, event):
if event.MouseEvent.LeftUp():
# Put the code
that you have here
event.Skip()This is how your openurl() method should be formed.
Is it?How to manually set the toggle state of wxpython platebutton<http://groups.google.com/group/wxpython-users/t/cf78675cbe7f2fec>
Samyak Jain <samyak.iitk@gmail.com> Mar 27 01:58AM -0700
I am building an application using platebutton iin wxpython. The
problem is
that I am not able to manually SetState of the toogle buton. I used
SetState(0) but it does not change the state of toggle button. Any
help
would be great. Thanks.I have attached a sample code file also. Also,
the
code is written below too.Sample code:
import wx
import wx.lib.platebtn as platebtnclass Toolbar(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer)
self.infinity= platebtn.PlateButton(self, -1, label='Button', size
= (80,40), style= platebtn.PB_STYLE_TOGGLE)
self.infinity.Bind(wx.EVT_TOGGLEBUTTON, self.OnInfinityToggled)
sizer.Add(self.infinity, 0)def OnInfinityToggled(self,event):
if event.GetEventObject().IsPressed():
self.popupmenu = wx.Menu()
Session = self.popupmenu.Append(-1, "Session")
Session2= self.popupmenu.Append(-1, "Session2")
self.Bind(wx.EVT_MENU, self.SessionMenu, Session)
self.Bind(wx.EVT_MENU, self.SessionMenu, Session2)
self.PopupMenu(self.popupmenu,(2,20))
self.Bind(wx.EVT_MENU_CLOSE, self.SessionMenu)
else:
passdef SessionMenu(self, event):
self.infinity.SetState(0)
self.infinity.Raise()
self.infinity.Refresh()if __name__ == '__main__':
app = wx.PySimpleApp(0)
f = wx.Frame(None)
p = Toolbar(f)
f.Show()
app.MainLoop()How to reorder a wxWindowList obtained from GetChildren() function<http://groups.google.com/group/wxpython-users/t/f9cd780880931e30>
Samyak Jain <samyak.iitk@gmail.com> Mar 27 01:39AM -0700
> Robin Dunn
> Software Craftsman
> http://wxPython.orgDear Robin,
Thanks a lot for your reply. It works perfectly now. Thanks a lot.
--
Samyaksnappiness of wxPython apps<http://groups.google.com/group/wxpython-users/t/4d3c757258b08756>
C M <cmpython@gmail.com> Mar 26 05:07PM -0400
I am one of a large number of slow computer owners. With 1.7 GhZ and 1
GB
or RAM on Windows XP, running my 50% fragmented laptop while Firefox
17.0.1
has a few pages/tabs open (and up to 600,000 KB of memory eaten), and
a few
other applications are open, can cause the computer to go into molasses
mode, where windows switching becomes painfully slow.In testing out a wxPython application, I just found that after it was
sitting unused-by-me and sort of running in the background while I used
other programs, like Firefox, and then I switched to it, the main
frame was
responsive but then when I did a user action that caused a wxDialog to
be
launched, it took about *20 seconds* for the dialog to appear. Yuck. I
then used and closed that dialog, did the same type of action again,
and
now the dialog popped up almost instantly. (I should note that I am
launching the whole app via Boa Constructor, an IDE).I think this super-slow vs. fast dialog appearance discrepancy may be
related to the "warm boot" of applications, in that when you close a
program down Windows doesn't *really* vacate the RAM of that program
but
sort of keeps it handy in case you need it again soon, but if you wait
too
long that RAM has to get used for something else.So, question #1: is that thinking right? Do the instructions for how to
make a dialog "hang around" when recently used and therefore dialogs
launch
much more quickly, but the instructions "fade away" if you haven't
launched
a dialog in a few hours and so have to be loaded from disk again?Question #2: Is there anything I could do about this to prevent it? I
know the real answer is that my computer is to blame, but I also know
that
the reality is that there are still a lot of people who have old/slow
computers (and sometimes far worse than mine, since, AFAIK, I don't
have
much or any malware). If there is something that can be done to
increase
"snappiness", it makes a huge difference, in my case, to usability of
the
application.I haven't tested this issue out on a py2exe'd version of my app, but
will.(And yes, I should get a better computer, and will...but in a way,
this one
has some value as a good test case for older computers).Thanks,
CheSteve Barnes <gadgetsteve@live.co.uk> Mar 26 09:27PM
> an email to wxpython-users+unsubscribe@googlegroups.com
> <mailto:wxpython-users+unsubscribe@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
If you only have 1GB of RAM, several other applications open and an
IDE
then most of your, not latest used, applications memory allocations
are
swapped to hard disk - when you swap the the application that has been
in background and try to do just about anything the RAM that it was
using has to be reconstructed from the hard disk, and to make the
space
for it a lot of that from the application that was running last has to
be swapped out to disk first. If your hard disk is fragmented and you
don't have a permanently allocated swap space it also has to find the
spare bits of disk before doing that. Hence the very slow response -
once you are running from RAM you are fine.To speed things up - close other Applications, De-fragment Disk,
Allocate at least the recommended swap file size as a permanent swap
file, don't us compressed disk _especially for swap disk_, all the
usual
tips. Keep in mind that support for XP ends next month.Hope that helps.
Gadget/Steve
David Woods <david@badgerchildhoodcancer.org> Mar 26 05:17PM -0500
I seem to recall that on machines with those specs, adding RAM made a
HUGE
difference in the situation you describe, exactly because then the app
you
are switching to is less likely to have been swapped to the hard drive
from
RAM, as Gadget/Steve said.This has nothing to do with wxPython, and py2exe probably won't help
just a
ton. It's an OS issue, not an application-specific issue.David
C M <cmpython@gmail.com> Mar 26 11:09PM -0400
Thanks, Gadget/Steve and David. Yes, I kind of suspected there was not
much if anything I could do programmatically, but I thought I'd check.
Maybe it's possible I can get a little more the illusion of
responsiveness
by having the dialog actually exist but be hidden (therefore all the
waiting will be at the time of switching the frame), but that is
probably
more trouble than it's worth.Perhaps the best thing is to just let users know that if they
experience
too-slow performance they should consider improving their
systems...probably the super-slow systems are mostly a small minority
by
now (and those that are still using them are unlikely to be using niche
desktop software anyway).Che
On Wed, Mar 26, 2014 at 6:17 PM, David Woods <
Michael Hipp <michael@redmule.com> Mar 26 10:16PM -0500
> systems...probably the super-slow systems are mostly a small
minority by
> now (and those that are still using them are unlikely to be using
niche
> desktop software anyway).Just a thought ... but what would happen if you had a wxTimer running
continually in the program and doing something innocuous? Would that
force the O/S to keep it in memory? What if the dialog were
instantiated
but now shown and was somehow involved with the wxTimer?And yes there are perhaps all kinds of reasons why that just might be
a
really bad idea.Michael
Nathan McCorkle <nmz787@gmail.com> Mar 26 07:53PM -0700
You could try turning RAM paging off, this can lead to really annoying
and
unstable behavior if/when your RAM fills up to the brim. Basically if
you
have paging off and fill up your physical RAM, things start to fail to
open, which can lead to a crash/locked system.Right-click on My Computer, click properties, click Advanced System
Settings, click the Advanced tab then click Settings under the
Performance
section, click the Advanced tab again (in the Performance options that
opened up), then finally click Change under 'Virtual memory'.I've got 8GB of RAM and still need paging
RAM is addictive.
C M <cmpython@gmail.com> Mar 27 12:51AM -0400
> You could try turning RAM paging off,
That's a good suggestion, but I was trying to come up with a way to
programmatically help those users who, for whatever reason, will not
or can
not take steps to enhance their computer's responsiveness--not speed
up my
own computer (though, thanks, anyway, and I may try that). I guess my
hope
was to give my applications, or any wxPython applications, the best
chance
at running responsively on these old/slow systems. Probably a misguided
thought in the first place.Steve Barnes <gadgetsteve@live.co.uk> Mar 27 06:05AM
> an email to wxpython-users+unsubscribe@googlegroups.com
> <mailto:wxpython-users+unsubscribe@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
You could use psutil: phymem_usage(), virtmem_usage() and
get_process_list() to determine when virtual memory is in use and
there
are other processes running and possibly hogging memory then warn the
user that they need to close some down, you could even tell them which
it taking the most.
psutil: Google Code Archive - Long-term storage for Google Code Project Hosting.Gadget/Steve
AcceleratorTable on OSX<http://groups.google.com/group/wxpython-users/t/d9d1d26a14381c39>
"Toni Ruža" <gmr.gaf@gmail.com> Mar 26 07:37PM +0100
Hi,
When I'm using AcceleratorTables in multiple controls (other than top
level
frames) as described in this post:http://wxpython-users.1045709.n5.nabble.com/Use-of-AcceleratorTable-tp2337246p2337254.html
it doesn't work on OSX (tested with wx 3.0.0 and 2.8.11).
Attached is a minimal sample, the focused text control should change
it's
value when you press the "Insert" key. It works on Windows.Am I doing something wrong?
Regards,
Toni"Toni Ruža" <gmr.gaf@gmail.com> Mar 26 10:24PM -0700
I now see that it has issues with certain keys like "Insert" in
particular,
and that "WANTS_CHARS" can help for some.Is this a platform limitation, and if so, is it documented somewhere?
--
Tonihow do expand window to show all tab labels by default?<http://groups.google.com/group/wxpython-users/t/81ca070f42dabf2c>
Nathan McCorkle <nmz787@gmail.com> Mar 26 07:45PM -0700
I'm munging a bunch of examples together, and basically have a
notebook
inside a scrolledPanel. I can't figure out how to make the default
size of
the frame appear with all the notebook tab text labels showing fully.here's my code
http://pastebin.com/sQC65BL8Seems like adding Layout or Fit randomly doesn't change anything.
wx.html2 and CMD C on OSX<http://groups.google.com/group/wxpython-users/t/20991dd794875a61>
Rish <rishsharma@gmail.com> Mar 26 08:45PM -0700
Hi all,
I'm using a wx.html2 based browser in a panel in a frame. It super
simple
and nothing else is on this control. I have found that neither CMD C
nor
CMD V work with text boxes or elements in the browser. I have no menu
enabled (its just a super simple browser/panel/frame paradigm). How do
I
workaround this or enable the ability to allow for CMD C/CMD V?Thanks!
-R
How to hold further execution of sub frame until it is closed or even
is clicked?<http://groups.google.com/group/wxpython-users/t/e3648401e68fed0f>Jaydeep Patil <patil.jay2009@gmail.com> Mar 25 11:13PM -0700
Hi all,
I constructed Two frames.
One frame consist of GUI which consist of one Ok button.Afer click on OK button another GUI calls. But after Second gui
calling, It
wont stop further procesees. I need to stop futher proceeses. How can
i
hold second gui?Please reply
Sample Code is:
import wx
class App(wx.App):
'''
classdocs
'''
def __init__(self,name=None):
'''
Constructor
'''
wx.App.__init__(self)
self.d = Dashboard()
self.d.Show()def _startMainLoop(self):
self.MainLoop()
passdef start(self):
#self.d.Show()
self._startMainLoop()
passclass Dashboard(wx.Frame):
'''
classdocs
'''
def __init__(self,name=None):
'''
Constructor
'''
wx.Frame.__init__(self,None,
wx.ID_ANY)
print("Frame 1")self.btnOk = wx.Button(self,-1,"OK")
self.btnOk.Bind(wx.EVT_BUTTON,self.test)
def test(self,event):
print("Before")
self.f = Dashboard1(self) ## I need to Stop here only
self.f.Show()
self.f.MakeModal(True)
print("AFter")class Dashboard1(wx.Frame):
'''
classdocs
'''
def __init__(self,parent):
'''
Constructor
'''
wx.Frame.__init__(self,parent,wx.ID_ANY)a = App()
a.start()problems with changing backgoundcolour in button event function. Also
using sizer<http://groups.google.com/group/wxpython-users/t/293c6be89c2d90c7>eightbits <jlala2010@gmail.com> Mar 25 09:43AM -0700
Thanks for the reply, I will keep banging away.
--
View this message in context:
http://wxpython-users.1045709.n5.nabble.com/problems-with-changing-backgoundcolour-in-button-event-function-Also-using-sizer-tp5720548p5720557.html
Sent from the wxPython-users mailing list archive at Nabble.com.--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
···
On Thu, Mar 27, 2014 at 12:53 PM, <wxpython-users@googlegroups.com> wrote:
On Thursday, March 27, 2014 4:52:57 PM UTC+8, luckrill wrote:
On Thu, Mar 27, 2014 at 04:28:41AM -0700, GRW wrote:
On Wednesday, March 26, 2014 9:39:21 AM UTC+5:30, Robin Dunn wrote:
On 26/03/14 21:07, C M wrote:
On 3/26/2014 10:09 PM, C M wrote:
On Wednesday, March 26, 2014 2:07:59 PM UTC-7, Che M wrote:
On 27/03/14 04:51, C M wrote:
On Wednesday, March 26, 2014 7:37:21 PM UTC+1, Toni Ruža wrote: