Shift+Backspace is Writing a Checkmark Symbol? - python

I can't even copy and paste a strange checkmark looking character from my IDLE interpreter session into this text field...I am running Linux Mint Julia, python version 2.6, but it also happens in 3.1. This occurs after holding the shift key and pressing backspace.
I tried doing this:
>>> ord('[strange-checkmark]')
8
Then running the reverse:
>>> chr(8)
\x08'
I'd really like to get this strange character to stop printing, and just delete the previous character instead.
I tried to recreate this character in gedit, terminal, and chrome. No luck. Searching for a ASCII chart of ordinal values calls this character backspace.
Here's an image from my session:

It's a confirmed bug within Tkinter, and not necessarily IDLE. See Issue 1482122.
In brief: If you want to fix it, you're welcome to try xmodmap -e "keycode 22 = BackSpace", but you run the risk of no longer being able to issue a Ctrl+Alt+Backspace to kill your X Server.
I can keep looking for more information into the bug; I'm not sure if the folks working on Tkinter have resolved this yet.
EDIT: Confirmed second source on issue - See Linux%Shift-Backspace on the Tkinter Wiki

Related

how to clear the screen in pycharm

I know these are questions: this and this and this. I have tried all of these methods in pycharm, but they either a) not work or b) I get a weird character on my screen, that looks like a 0 with diagonal line going through it. I can't copy it for some reason, so I can't show you.
For instance this:
import os
from time import sleep
print("lots of text")
sleep(5)
os.system('cls')
What should happen in the above is tht the message should be displayed for 5 seconds then disappear, but all I get is that weird character... In contrast when I ran my python program from command line, it worked as expected i.e. the screen cleared. I am very confused.
So my questions are:
Why don't any of them work in pycharm?
What does work in pycharm?
Ok, so, I have been having this problem as well — after scouring the internet, the os commands work BUT you need to enable the terminal emulator.
In the PyCharm toolbar, click Run, Edit Configurations, and the toggle for "Emulate Terminal in Output Console" should be under Execution in the pop up. Emulate Terminal toggle
I had to get help from the PyCharm team on this one, so here's to them responding at lightning speed.
Answer
The cls command doesn't work on a standard pycharm project because it is an IDE and certain os commands don't work in the same way it would with the windows command line.
There is currently no way to clear the console output in PyCharm, other than to manually do it by using the cls command through the terminal in PyCharm or through a keyboard shortcut set through the pycharm preferences menu. You can try to emulate a keyboard shortcut, but this would be difficult, and unless you absolutely need it, I would not recommend clearing the terminal output after a program is run.
References and Additional Links
https://teamtreehouse.com/community/clear-screen-for-pycharm-as-if-it-were-on-console-or-cmd
I don't know in which version of PyCharm this was introduced. I guess it must have been after this question was asked.
The way to clear the PyCharm Python Console is by using the context menu. Right mouse click in the upper part of the console (where the lines with >>> prompts are closer together) and select Clear All.
Alse see this PyCharm Support Community article.
Incidentally, none of the questions linked to in the OP's original post relate to PyCharm and do not answer the OP's question.
cls only temporarily clears it. Next command brings back all previous messages. The best option is to right click on the Terminal and choose Clear Buffer

Missing symbols in Pyautogui typewriter

I have a problem, that consists in following: Pyautogui typewrite won't type letters, only numbers. For example, when I execute
pyautogui.typewrite("abc123")
only "123" appears.
This question is similar to this one:
Pyautogui typewrite is writing only numbers
Unfortunately, there are no answers about the issue, as well as other Internet topics.
I have the Windows 7 machine and Python 3.5.
There seems to be a bug in the typewrite function of PyAutoGui. I workaround it with this function which preprocesses the string into keypresses instead. Note that this version of the function leaves a comma at the end of the output array so that you can easily append more characters or button presses at the end.
def preprocess(something):
something = str(something)
output = []
for x in range(len(something)):
output.append(something[x])
output.append(',')
return output
I faced the same problem. I was not able to send letters using typewrite() function.This bug in PyAutoGUI can be overcome by installing OpenCV 3.1.0
Download openCV 3.1.0 from below site:
1) https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/opencv-
3.1.0.exe/download
2) Extract the OpenCV -> Then go to OpenCV\build\python\2.7\x64 and copy cv2.pyd to C:\Python27\Lib\Site-packages
And your problem will be solved. Give it a try, it worked for me
I had the same problem couple of days ago
Try using other pyautogui functions that presses keyboard keys like pyautogui.press("k")
If you have a problem with all keyboard functions related to letters in general it's probably because your default input language is set to something other than english
you can fix that easily by going to your keyboard and input settings and changing the default input language to english
you'll still be able to write in your first language and it will hopefully solve your problem

python win32api.LoadKeyboardLayout(), doesnt change language in IDLE shell?

Can someone help me out please...I'm trying to start my first programming project. It will be implemented in python.
I need to have a textbox (which i am using wxpython for). If the user enters any text into this text box, then I want it to appear as arabic. I wanted to this by automagically changing the users Keyboard to an arabic layout when the cursor lands in the given text box.
So i found this pywin32 module, which has a function LoadKeyboardLayout()
So i am trying to test this in IDLE, to see if I can make it accept arabic text into IDLE, to see if it works. So I enter, into IDLE:
win32api.LoadKeyboardLayout('00000401',1)
This then returns, 67175425, the decimal equivalent of hex:'4010401' whcih I believe is the locale ID for Arabic. SO I think wow! I've done it, but when I try typing after this, in the IDLE window, it continues to type normal english characters.
Can someone please explain my errors and guide me towards a good solution.
UPDATE
Okay, I've been trying to solve this problem ever since posting the damn question.
No luck.
Then, I thought, "ok, screw it, instead of testing it quicly in IDLE, I will just try it out, in situ, in my source code for the project."
WTF - it worked first time, giving exact behaviour that I wanted.
Then I tried it in a different IDE, in the interpreted window, and again, IT WORKED straight away!
So clearly my issue is with IDLE, in its interpreting mode.
Can anyone explain why it doesn't work in the IDLE shell???
Keyboard layout setting in Windows is per-process (and inherited from the parent process)
IDLE runs your Python script in a background process separate from its GUI
So you have successfully changed the keyboard layout of the background Python process that is running your script, but not of IDLE's GUI.

Anyway to bring up suggestion box when typing python code

I'm learning wxpython right now and one thing that helps me ALOT is when I'm typing in the text editor I sometimes press the tab key to give me a hint on what I'm looking for...This is great when it works but I notice sometimes it doesn't work and I get lost looking for a syntax I can't remember...
Question is how can I get the suggestion box to pop back up again, Or what am I doing that causes it to stop coming up...
if it matters I backtracked to 2.7 to learn wx, Windows 7
Edit: More specifically... when I type: wx.(Here is normally when I would press tab)
What editor do you use??
Without knowing that there's no way we can possibly help you.
FWIW in vim I use C-x [onp]

indent with 'tab' button in python commandline

hi everyone :)
my problem is, up until now, i have exclusively used tabs to indent python, as i find it easier than spaces, but for no reason i know, python interactive prompt, the basic python.exe one, suddenly refuses to accept the tab button, all it does is flash the cursor. all i can think of is that my computer in suddenly treading the window like any other, using tab to cycle input things, in this case the single one. also, before now, i could use the up button to reach previously typed code, the if i submit that line with no changes, use the down button to access the line that came after it, but now up works, but as if i had changed the line, eg moves me back to the "bottom" of the list of inputs, so down doesn't work.... my question simply is: how do i get my good old tab and down button to work like i want them to again? :(
thanks xxx
If you are using Windows with the standard cmd.exe console (and it would have been helpful for you to have stated this up front) then you can use the TAB and arrow keys exactly as you desire.
I recently observed this behavior too, on Windows, using cmd.exe. It also happens with Console2 - an alternate shell I sometimes use.
Though I do always use spaces in normal code in an editor, I had been accustomed to using the Tab key to indent in short multi-line inputs in the interactive python.exe interpreter. Recently that stopped working - pressing the Tab key flashes the cursor and doesn't indent. Using spaces does work fine here, though it's not as convenient past a couple of indentations.
I suspect (but am not certain) that the cause was installation of pyreadline or rlcompleter - I had been messing with trying to get tab completion in an interpreter in an embedded application on Windows. Of course in your case another installation could have included those packages.

Categories

Resources