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

  • Home
  • SEARCH
  • 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 6758225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:45:22+00:00 2026-05-26T13:45:22+00:00

I have a weird problem. I can only copy the text once. If I

  • 0

I have a weird problem. I can only copy the text once. If I press clear and type again the text disappears and I have to restart it. Where have I messed up?

Now the questions:

1) Can I bind the clear function to the “Encrypt/Decrypt” so that each time I want to type again it
clears automatically?

2)How can I copy the output to the clipboard with a button?

Code(Pretty messy):

import wx

class main(wx.Frame):



    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Title',size=(353,270))

        self.panel=wx.Panel(self)

        button1=wx.Button(self.panel,label='Encrypt\Decrypt',pos=(10,10),size=(-1,60))
        button2=wx.Button(self.panel,label='Current PIN',        pos=(150,10),size=(-1,60))
        button3=wx.Button(self.panel,label='Change PIN',           pos=(250,10),size=(-1,60))
        button4= wx.Button(self.panel,label='Reset',pos=(10,200),size=(-1,20))

        self.Bind(wx.EVT_BUTTON, self.option1, button1)
        self.Bind(wx.EVT_BUTTON, self.option2, button2)
        self.Bind(wx.EVT_BUTTON, self.option3, button3)
        self.Bind(wx.EVT_BUTTON, self.clear,  button4)

        self.Bind(wx.EVT_CLOSE,self.closewindow)
        self.pin='ABC'

    def option1(self,event):
        box1=wx.TextEntryDialog(None,'Type...','','...here')
        if box1.ShowModal()==wx.ID_OK:
            answer1=box1.GetValue()

        def xor(text, key):
            list = ''
            for char in text:
                for ch in key:
                    char = chr(ord(char) ^ ord(ch))
                list += char
            return list

        msg = xor(answer1, self.pin)
        self.output=wx.TextCtrl(self.panel, -1,msg,pos=(10,80),size=(300, 100), style=wx.TE_MULTILINE|wx.TE_READONLY)
        #output=wx.StaticText(self.panel,-1,msg,(10,80),(260,-1),wx.ALIGN_CENTER)


    def option2(self,event):
        box2=wx.MessageDialog(None,self.pin,'Current PIN',wx.OK)
        answer2=box2.ShowModal()
        box2.Destroy()

    def option3(self,event):
        box3=wx.TextEntryDialog(None,'Type...','','...here')
        if box3.ShowModal()==wx.ID_OK:
            answer3=box3.GetValue()
            self.pin=answer3

    def closewindow(self,event):
        self.Destroy()

    def clear(self,event):
        self.output.Clear()






if __name__=='__main__':
    app=wx.PySimpleApp()
    frame=main(parent=None,id=-1)
    frame.Show()
    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-26T13:45:22+00:00Added an answer on May 26, 2026 at 1:45 pm

    Every time you push the button (method option1) you create a new overlapping TextCtrl. You should have created in the constructor and just change the text in the method.

    1) Just call self.output.Clear() at the beginning of the option1 method.

    2)

    clipdata = wx.TextDataObject()
    clipdata.SetText("Text here")
    wx.TheClipboard.Open()
    wx.TheClipboard.SetData(clipdata)
    wx.TheClipboard.Close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a weird problem that i can't figure out a solution for: I've
I have a weird date rounding problem that hopefully someone can solve. My client
I have a very weird problem that I can't understand. This is C code:
I have encountered a weird problem and I can't manage a way to solve
I have a very weird problem. This ONLY affects Firefox on Mac, using the
i have a weird problem. i would like to delete an assembly(plugin.dll on harddisk)
I have a weird problem with images in visual web developer, I cant change
I have a weird problem where after setting nocheck on a foreign constraint and
I have this weird problem with setting up cookies with PHP. Everything worked fine
I have a weird problem, and I don't know if this is the default

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.