Hi,
Mark wrote:
wow, I would have thought that even outlook express used
proper mime attachments, is that uuencode?
- Yes, I'm using outlook express
- As far as I know, it's not uuencoded
- I do not understand why my attached code looks like
this. *Any explanations and/or proposals are welcome*.
- Last time I send an attached code, (Robin asked to me to
do
so), Robin replied with a thank, so I assumed the receieved
code was ok
- I'v tried Mozilla, but it takes more than one minute to
load and run!
- The code again (as part of this message)
···
#-----------------------------------------------------------
--------
# atextctrl.py
# win98se, py 2.2.3, wxpy 2.4.0.7 AND wxpy 2.4.1.2
# 16 July 2003
# by Jean-Michel Fauth, Switzerland
#-----------------------------------------------------------
--------
from wxPython.wx import *
#-----------------------------------------------------------
--------
class MyPanel(wxPanel):
def __init__(self, parent, id):
wxPanel.__init__(self, parent, id,
wxDefaultPosition, wxDefaultSize)
# code
1 ----------------------------------------------------
#a single wxTextCtrl, default style
self.tc = wxTextCtrl(self, 1001, '', wxPoint(8, 8),
wxSize(450, 40))
self.tc.SetValue('abcdef')
#abcdef is highlighted/selected
print self.tc.GetInsertionPoint()
#print 0, and the caret is at the end!
self.tc.SetSelection(3, 5)
#nothing happens, caret still at the end
self.tc.Replace(1, 3, 'zzz')
#works ok, this seems to prove the text was indead
selected
# code
2 ----------------------------------------------------
#a single wxTextCtrl, default style plus a button
#~ self.tc = wxTextCtrl(self, 1001, '', wxPoint(8,
8), wxSize(450, 40))
#~ self.tc.SetValue('abcdef')
#~ self.but = wxButton(self, 2001, 'button',
wxPoint(8, 72), wxDefaultSize)
#~ self.but.SetFocus()
#ok, no selection
#~ EVT_BUTTON(self.but, 2001, self.OnClick1)
#~ def OnClick1(self, event):
#~ print 'OnClick1'
#~ self.tc.SetFocus()
#~ print self.tc.GetInsertionPoint()
#print 0, and the caret is at the end!
#~ self.tc.SetSelection(2, 4)
#works ok
# code
3 ----------------------------------------------------
#a single wxTextCtrl, default style
#~ sty = wxTE_MULTILINE
#~ self.tc = wxTextCtrl(self, 1001, '', wxPoint(8,
8), wxSize(450, 340), sty)
#~ self.tc.LoadFile('mail.txt')
#the whole text is selected
# code
4 ----------------------------------------------------
#with rich text capabilities
#~ sty = wxTE_MULTILINE | wxTE_RICH2
#~ self.tc = wxTextCtrl(self, 1001, '', wxPoint(8,
8), wxSize(450, 340), sty)
#~ attrib = wxTextAttr('RED', 'YELLOW', wxFont(10,
wxMODERN, wxNORMAL, wxNORMAL))
#~ self.tc.SetDefaultStyle(attrib)
#entering text from the keyboard is ok
#but with wxTE_RICH, the default styling does not
apply
# code
5 ----------------------------------------------------
#with rich text capabilities
#~ sty = wxTE_MULTILINE | wxTE_RICH2
#~ self.tc = wxTextCtrl(self, 1001, '', wxPoint(8,
8), wxSize(450, 340), sty)
#~ attrib = wxTextAttr('RED', 'YELLOW', wxFont(10,
wxMODERN, wxNORMAL, wxNORMAL))
#~ self.tc.SetDefaultStyle(attrib)
#~ self.tc.WriteText('abcdef')
#abcdef is selected
#~ print self.tc.GetInsertionPoint()
#print 6, but the whole text is selected
#~ self.tc.SetSelection(2, 4)
#not ok
# code
6 ----------------------------------------------------
#with rich text capabilities
#~ sty = wxTE_MULTILINE | wxTE_RICH2
#~ self.tc = wxTextCtrl(self, 1001, '', wxPoint(8,
8), wxSize(450, 340), sty)
#~ attrib = wxTextAttr('RED', 'YELLOW', wxFont(10,
wxMODERN, wxNORMAL, wxNORMAL))
#~ self.tc.SetDefaultStyle(attrib)
#~ self.tc.LoadFile('mail.txt')
#the whole text is selected, I do not see a blinking
caret
#default style is not applied!
#~ print self.tc.GetInsertionPoint()
#print 0, I do no see any blinking caret
#-----------------------------------------------------------
--------
class MyFrame(wxFrame):
def __init__(self, parent, id):
title = 'atextctrl'
style = wxSYSTEM_MENU | wxCAPTION | wxMINIMIZE_BOX
wxFrame.__init__(self, parent, id, title, wxPoint(0,
0), \
wxSize(500, 500), style)
self.panel = MyPanel(self, -1)
#-----------------------------------------------------------
--------
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(None, -1)
frame.Show(True)
self.SetTopWindow(frame)
return True
#-----------------------------------------------------------
--------
def main():
app = MyApp(0)
app.MainLoop()
#-----------------------------------------------------------
--------
if __name__ == "__main__" :
main()
#eof--------------------------------------------------------
-----------
Jean-Michel Fauth, Switzerland