Re: wx.GetDefaultPyEncoding()

"Werner F. Bruhin" <[email protected]>
Newsgroups gmane.comp.ide.boa-constructor.user
Message-ID <[email protected]>
Gianfranco,

Was this string "Il tipo non e :"  always like this or did was it like:

this "Il tipo non é :" or something similar?

When I use é or similar in the source code I do get encoding errors 
similar to the original one you reported.

If you want non ascii chars in your source code then you need to add:

# -*- coding: iso-8859-1 -*-#

or similar as the first line of every file.  I changed the attached file 
which is in ...\site-packages\boa\Plug-ins to include that line and then 
I just click the second to last tool bar button on the editor.

Werner

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

_______________________________________________
Boa-constructor-users mailing list
Boa-constructor-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/boa-constructor-users
CustomModuleInfo.plug-in.py (text/plain, 631 B)
""" Demonstrates how to change system constants as a plug-in """

import sourceconst
# The order of (Name)s may change and lines may also be removed
sourceconst.defInfoBlock = sourceconst.wsfix(
'''# -*- coding: iso-8859-1 -*-#
#-----------------------------------------------------------------------------
# Name:        %(Name)s
# Purpose:     %(Purpose)s
#
# Created:     %(Created)s
# RCS-ID:      %(RCS-ID)s
#-----------------------------------------------------------------------------
''')

import Preferences
# (Name)s not in the original dictionary needs to be added
##Preferences.staticInfoPrefs['NewField'] = 'Whatever'
Frame1.py (text/plain, 6.5 KB)
# -*- coding: iso-8859-1 -*-#
#-----------------------------------------------------------------------------
# Name:        Frame1.py
# Purpose:     
#
# Created:     2007/08/21
# RCS-ID:      $Id: Frame1.py $
#-----------------------------------------------------------------------------
#Boa:Frame:Frame1


import wx
import wx.calendar
import Dialog1
import Dialog2

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON3, 
 wxID_FRAME1CALENDARCTRL1, wxID_FRAME1COMBOBOX1, wxID_FRAME1PANEL1, 
 wxID_FRAME1SLIDER1, wxID_FRAME1STATICBOX1, wxID_FRAME1STATICBOX2, 
 wxID_FRAME1STATICTEXT1, wxID_FRAME1STATICTEXT2, wxID_FRAME1STATICTEXT3, 
 wxID_FRAME1STATICTEXT4, wxID_FRAME1STATICTEXT5, wxID_FRAME1STATICTEXT6, 
 wxID_FRAME1STATICTEXT7, wxID_FRAME1STATICTEXT8, 
] = [wx.NewId() for _init_ctrls in range(17)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(187, 26), size=wx.Size(527, 487),
              style=wx.DEFAULT_FRAME_STYLE, title='Schermo di partenza')
        self.SetClientSize(wx.Size(519, 460))

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
              pos=wx.Point(0, 0), size=wx.Size(519, 460),
              style=wx.TAB_TRAVERSAL)

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1,
              label='Apre una finestra per valore', name='button1',
              parent=self.panel1, pos=wx.Point(48, 120), size=wx.Size(200, 23),
              style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
              id=wxID_FRAME1BUTTON1)

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
              label='Questo serve per provare il bottone', name='staticText1',
              parent=self.panel1, pos=wx.Point(88, 40), size=wx.Size(262, 21),
              style=0)
        self.staticText1.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD,
              False, 'Comic Sans MS'))

        self.staticText2 = wx.StaticText(id=wxID_FRAME1STATICTEXT2,
              label='Questo  il testo che cambia.....', name='staticText2',
              parent=self.panel1, pos=wx.Point(104, 240), size=wx.Size(149, 13),
              style=0)
        self.staticText2.SetForegroundColour(wx.Colour(255, 0, 0))
        self.staticText2.SetBackgroundColour(wx.Colour(255, 255, 0))

        self.comboBox1 = wx.ComboBox(choices=["ancora", "12", "14"],
              id=wxID_FRAME1COMBOBOX1, name='comboBox1', parent=self.panel1,
              pos=wx.Point(304, 96), size=wx.Size(168, 21), style=0,
              value='Scegli')
        self.comboBox1.SetLabel('Scegli')
        self.comboBox1.Bind(wx.EVT_TEXT, self.OnComboBox1Text,
              id=wxID_FRAME1COMBOBOX1)

        self.staticText3 = wx.StaticText(id=wxID_FRAME1STATICTEXT3,
              label='Il tipo ', name='staticText3', parent=self.panel1,
              pos=wx.Point(112, 264), size=wx.Size(34, 13), style=0)
        self.staticText3.SetBackgroundColour(wx.Colour(128, 128, 255))
        self.staticText3.SetForegroundColour(wx.Colour(0, 255, 0))

        self.staticBox1 = wx.StaticBox(id=wxID_FRAME1STATICBOX1,
              label='Ambaradan', name='staticBox1', parent=self.panel1,
              pos=wx.Point(16, 88), size=wx.Size(256, 144), style=0)
        self.staticBox1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Microsoft Sans Serif'))

        self.slider1 = wx.Slider(id=wxID_FRAME1SLIDER1, maxValue=100,
              minValue=0, name='slider1', parent=self.panel1, point=wx.Point(64,
              320), size=wx.DefaultSize, style=wx.SL_HORIZONTAL, value=0)
        self.slider1.Bind(wx.EVT_COMMAND_SCROLL_THUMBRELEASE,
              self.OnSlider1CommandScrollThumbrelease, id=wxID_FRAME1SLIDER1)

        self.staticText4 = wx.StaticText(id=wxID_FRAME1STATICTEXT4,
              label='Valore slide', name='staticText4', parent=self.panel1,
              pos=wx.Point(112, 296), size=wx.Size(54, 13), style=0)

        self.calendarCtrl1 = wx.calendar.CalendarCtrl(date=wx.DateTime.Now(),
              id=wxID_FRAME1CALENDARCTRL1, name='calendarCtrl1',
              parent=self.panel1, pos=wx.Point(304, 128), size=wx.Size(179,
              128), style=wx.calendar.CAL_SHOW_HOLIDAYS)

        self.staticBox2 = wx.StaticBox(id=wxID_FRAME1STATICBOX2,
              label='staticBox2', name='staticBox2', parent=self.panel1,
              pos=wx.Point(288, 72), size=wx.Size(200, 248), style=0)

        self.button3 = wx.Button(id=wxID_FRAME1BUTTON3,
              label='Sceglie due date', name='button3', parent=self.panel1,
              pos=wx.Point(48, 168), size=wx.Size(200, 23), style=0)
        self.button3.Bind(wx.EVT_BUTTON, self.OnButton3Button,
              id=wxID_FRAME1BUTTON3)

        self.staticText5 = wx.StaticText(id=wxID_FRAME1STATICTEXT5,
              label='Data inizio e', name='staticText5', parent=self.panel1,
              pos=wx.Point(48, 368), size=wx.Size(72, 13), style=0)

        self.staticText6 = wx.StaticText(id=wxID_FRAME1STATICTEXT6, label='',
              name='staticText6', parent=self.panel1, pos=wx.Point(296, 368),
              size=wx.Size(0, 13), style=0)

        self.staticText7 = wx.StaticText(id=wxID_FRAME1STATICTEXT7,
              label='Data Fine e ', name='staticText7', parent=self.panel1,
              pos=wx.Point(48, 400), size=wx.Size(58, 13), style=0)

        self.staticText8 = wx.StaticText(id=wxID_FRAME1STATICTEXT8, label='',
              name='staticText8', parent=self.panel1, pos=wx.Point(296, 416),
              size=wx.Size(0, 13), style=0)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnButton1Button(self, event):
        self.dia = Dialog1.create(self)
        self.dia.ShowModal()
        txt = 'La Valeur est : '+ self.dia.transfer()
        tipo = type(self.dia.transfer())
        self.staticText2.SetLabel(txt)
        self.staticText3.SetLabel(('Il tipo non é : %s' ) % str(tipo))
        self.dia.Destroy()

    def OnSlider1CommandScrollThumbrelease(self, event):
        event.Skip()

    def OnSlider1CommandScrollThumbtrack(self, event):
        self.staticText4.label = self.slider1

    def OnComboBox1Text(self, event):
        prova = self.comboBox1.GetValue()
        self.staticText2.SetLabel(prova)

    def OnButton3Button(self, event):
        self.dia2 = Dialog2.create(self)
        self.dia2.ShowModal()
        txt2 = self.dia2.transfer()
        self.staticText5.SetLabel(str(txt2[0]))
        self.staticText7.SetLabel(str(txt2[1]))
        self.dia2.Destroy()
App1.py (text/plain, 475 B)
#!/usr/bin/env python
#Boa:App:BoaApp

import wx

import Frame1

modules ={'Dialog2': [0, '', 'Dialog2.py'],
 'Frame1': [1, 'Main frame of Application', 'Frame1.py']}

class BoaApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        self.main = Frame1.create(None)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True

def main():
    application = BoaApp(0)
    application.MainLoop()

if __name__ == '__main__':
    main()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.