Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Look over this code
#1
Hey guys would anyone be able to look over this for a buddy of mine and see why this is not working. I’m not familiar with really any python.

From what I understand they have an account who has to write 80 paragraphs for their thing and then need a break. Whenever they enter it it gets rid of the paragraphs. So he had the idea to come up with this to fix that problem.

This might be super simple,

Thank you very much!

def insert_line_breaks():

    editor.beginUndoAction()

    pos = 80

    while pos < editor.getTextLength():

        editor.insertText(pos, '\n')

        pos += 81  # Move to the next position after the newly inserted line break

    editor.endUndoAction()

 

insert_line_breaks()
Gribouillis write May-24-2024, 05:13 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Look over this code - by dknobby7 - May-23-2024, 11:27 PM
RE: Look over this code - by ebn852_pan - May-24-2024, 01:56 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020