Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7530309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:52:36+00:00 2026-05-30T04:52:36+00:00

I have create in MySQdb a DB with a table named example,in this table

  • 0

I have create in MySQdb a DB with a table named example,in this table i want to save a name,
this name is in Greek language.My problem is thw follown when i try to save the name instantly without use textctrl, its ok but when i use textctrl i take error.Look the code:
Can anyone hel me please i have try encoding in utf-8,decoding in utf-8, to unicode but nothing.

import os
import math
import random
import wx
import MySQLdb 
import sys
APP_SIZE_X = 500
APP_SIZE_Y = 300

# -*- coding: utf-8 -*-

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, size=(APP_SIZE_X, APP_SIZE_Y))

        panel = wx.Panel(self, -1,style=wx.SUNKEN_BORDER)

        wx.StaticText(panel, -1,'Name', (10, 55),style=wx.LEFT)
        self.name = wx.TextCtrl(panel, -1, '', (110, 55), (120, -1))

        save = wx.Button(panel, 1, 'Save', (70, 215),(130,-1))
        save.Bind(wx.EVT_BUTTON,self.OnSaveAsFile)

        quitbtn = wx.Button(panel, 1, 'Quit', (250, 215),(130,-1))
        quitbtn.Bind(wx.EVT_BUTTON,self.OnQuit)

    def OnSaveAsFile(self, event):

        idis="000"
        newname=self.name.GetValue()



        db=MySQLdb.connect(host="localhost",use_unicode="True",charset="utf8",user="root",passwd="root",db="test")
        cursor=db.cursor()

        sql="""INSERT INTO TB_EXAMPLE(name) VALUES("%s","%s")"""%(idis,newname)


        try:


            cursor.execute(sql)

            db.commit()
            print 'save ok'
        except:

            print 'no save'
            db.rollback()

    def OnQuit(self,e):

        self.Close()








class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, 'form1.py')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:52:38+00:00Added an answer on May 30, 2026 at 4:52 am

    Are you using the unicode version of wxPython? That might just fix this problem. Or you could take a look at the following two links:

    • http://wiki.wxpython.org/RecipesI18n
    • http://wiki.wxpython.org/Internationalization

    You might be able to fake it just by doing something like this:

    newname= u"%s" % self.name.GetValue()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have create name range on sheet A so I need to use this
I have create two tables with reference with another table: I like this: Table1:
I have create my own NSOpenGLView class, right now the data that i want
This is what I currently have: CREATE OR REPLACE TRIGGER MYTRIGGER AFTER INSERT ON
I've read this book section about git branches. I have create a branch called
I have create dynamic listview based on database but the problem is to load
I have encountered a problem when trying to select data from a table in
I have create a web service using WCF and I want to display, let's
i have create map in app. i want to show check-ins in it. i
I have create android listview that fill in using String array. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.