Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Show Lines Number
-
Hi,
A new Pythonista user here, is there a way to show the line numbers in the code editor?
Thanks for your help.
-
I'm not sure what you mean exactly... Pythonista always shows line numbers on the left side of the main editor, and it doesn't look like there's a way to disable that. If you're talking about the console window, it's not possible to show line numbers there. (Though I can't think of any situation where numbered lines in the console would be useful.)
-
I guess you're running Pythonista on an iPhone? Line numbers are currently only supported on iPad, sorry.
I might change that at some point, not sure yet – up until the iPhone 6/Plus, there simply wasn't enough room on the screen for line numbers, but on these bigger phones, it might make sense to show them optionally.
-
@omz. Thanks. I Intentionally got 6 Plus hoping it would be easier for Pythonista editing. Already selection works much better. Landscape editing is possible now. The keypad is so big on the iphone5 in landscape mode only a couple of lines of text are visible. The difference between the 6+ and the mini-est ipad is not a lot at least height wise. Some features would work as well so thanks for considering it.
-
Hi @omz I have an iPhone 5, it would be nice to have an option maybe in the keyboard special line that show/hide the line numbers, it would be useful and way more productive, thanks a lot everyone for your answers.
-
I vote for line numbers. 6 plus here.
-
I'm on a 5, I'd like at least an option for line numbers. I do most stuff on my iPad, but iPhone productivity is decreased because of this. When it throws a syntax error on line 65, but doesn't highlight and jump to it, I can't find line 65 without significant trouble.
-
I don't have an iphone to test this on, but you could try this:
# coding: utf-8 from objc_util import * app=UIApplication.sharedApplication() rootVC = app.keyWindow().rootViewController() tabVC = rootVC.detailViewController() tvc=tabVC.selectedTabViewController() ed=tvc.editorView() tv=ed.textView() tv.showLineNumbers=not tv.showLineNumbers() #not sure how to force a redraw. changing frame size works oldframe=tv.frame() newframe=oldframe newframe.size.width-=1 tv.frame=newframe import time time.sleep(0.1) tv.frame=oldframe
maybe use in an action script, and it should toggle line numbers in the current tab. Not sure if the view heirarchy is the same on iphone, so maybe this won't work.
-
This script is fantastic on my iPhone 6s. It even shows line wraps with a dot. This really needs to be added in a new update by default.
-
@JonB is there any way to change the color? Black really clashes with my theme. Also, can I make it flush with the edge of the editor?
-
updated... https://gist.github.com/bbd5ef7e2e4010a631bd
background color works. I didn't bother messing with the gutterSeparatorView, but you should be able to adjust that color to match the theme ( i forget where the theme is actually stored)note you cam change gutterWidth and the number font changes, so you can go as small as your eyes will work. 20 seems reasonable, the default seemed to be 35 on my ipad. I suppose I should put this inside a function so it does not mash globals, and you can toggle on/off as desired.
-
@JonB thanks. There's still black stripes around it, but they're not too obtrusive. This is also a relatively impermanent solution because it goes away after switching scripts
-
I think a short description might be useful:
- Touch the script name (togglelinenumbers.py)
- Go to Actions (tool symbol)
- Edit => + => Done => Done => Cancel
- Open your script
- Repeat step 1, 2 and run togglelinenumbers.py
-
@brumm I understand. I just wish they were always on.
-
-
@antibody Note that the better way to this is now as mentioned here