Screenplay formatting with kivy - python

I'm wondering if there's a way to have an MD text field that is able to format correctly to screenplay format? My goal is to have buttons along the top of an app that select the correct format ie choosing justify and forcing all caps. From what I can see so far this isn't possible with kivy but I'm willing to be corrected if I'm wrong.
Thanks

Related

How to remove borders on Tkinter buttons & frames?

I am currently building a simple app to encrypt files using AES encryption in python but the biggest downside of using Tkinter is the look of the UI. I did some research and found examples of what I want but do not know how to recreate it. (Example)
My problem is that when I replace buttons with images (like the OP of the Reddit post said he did in order to have a decent looking UI) I end up with an ugly bar of grey. (Image of the button)
I also want to remove the same type of bar with frames so if you have the answer for specifically that it would still be appreciated.
Support for for styles and themes has existed in tkinter for some time. A theme being a collection of styles for different widgets.
You can read more about style and themes here.
To the best of my knowledge, the standard widgets to not support rounded corners. All widgets have rectangular shapes.
You might be able to create something like that using a Canvas, but it would be a significant amount of work.
A more relevant point is that it might confuse your users if you don't reproduce the way the standard controls work.
UI elements are standardized for the same reason the controls in a car are; once you know one of them you can use all of them.

Formating text in a Qtext edit

I am working on a Pyqt5 soft which can print a text in a qtext edit.
2 qcombobox allows the user to choose the text.
The text displayed in the qtext edit is loaded from json files.
This part of the soft is ok.
For now, i want the user to be able to edit the files ( i need to change style, especially put the text in bold).
I think that the best way to do it is with html, but i can’t manage the balise insertion.
I also face issues by selecting only part of the text.
i don't really understand the cursor/ anchor fonctions and don't have find explicit documentation.
Any one to give me an advice, or even part of the code that can help me ?
thank you in advance !

Different behavior in powerpoint and libreoffice by ppt generated using python-pptx

I am trying to create a file using python-pptx on a flask server. All of this is working and even the download is working by the problem comes when I try to use text_frame.auto_size in my code. LibreOffice Impress displays the text perfectly but MS Powerpoint does not display the text properly.
Here are the images explaining the issue -
LibreOffice -
Powerpoint -
Also, here is the code that I am using -
text_box = slide.shapes.add_textbox(left, top, width, height)
text_frame = text_box.text_frame
text_frame.word_wrap = True
text_frame.auto_size = MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
Any idea what I am doing wrong here?
This is unfortunately a limitation of PowerPoint and an unusual (in my experience) place where LibreOffice actually does better.
You'll notice that if you click in the PowerPoint text, insert a space and then delete it, that the text will automatically autofit. This may not fix the problem, but it points to the cause.
In the XML behind the slide, the current "auto-fitted" font size of the textbox is cached. LibreOffice automatically recalculates this cached figure when the presentation opens; PowerPoint does not.
Calculating the "auto-fitted" font size is the job of the rendering engine, which has access to font sizes, line/word breaks, etc. python-pptx does not include a rendering engine nor does it have access to one (none exists for Python as far as I know). So the best it can do is estimate it and it prefers not to do that, since that's getting into rendering.
However, there is an experimental feature in the form of the .fit_text() method that may get you most of the way there. Basically, that capability was so wanted that someone was willing to sponsor a "best-efforts" solution, which is what that method represents. The documentation at that link explains how to use it and its limitations.
Note that that method is experimental, meaning it won't be considered a bug if it doesn't work the way you need it to. You're free to elaborate it if you can do better.

Python GUI: Organizing and Interacting with Displayed Text- Need help to find suitable widget/object

I am quite new to Python and have been writing my first GUI with tkinker with mostly ttk widgets. I have been searching for the better part of a day to figure out how to best go about solving a problem.
My goal: To create a document that will have check boxes next to each entry that when selected to perform an action. I have all the data management figured out. The issue is that I will have a variable number of entrees each with a variable about of text. What i am trying to do is figure out which widget or other object i should use to 1st keep inserted chunks of text aligned with a particular check box and 2nd have the view be scroll-able and locate-able(IE click on words in table of contents and have it bring to view said text from long list of entrees). Would anyone happen to have any suggested library or widgets i should look into to get this working?
I have thought about using many text boxes and linking check boxes to each text box. I cannot however figure out how to make these multitude of text boxes sit in a scroll-able frame that will re-size based on content and still have coordinates to point to that will adjust the view to the proper entry when selected from a table of contents.
A really great tutorial, which takes you through a bunch of widgets can be found here.
http://zetcode.com/gui/pyqt4/
I went through it today, and I already have a working application with QSliders, QFrames, a graph widget and a bunch of controls.

How to display parsed JSON text

Let me start off by saying that I'm starting this project to get familiar with Python. The project is to parse JSON from Reddit.com every 15 minutes and then display it with Tkinter.
Parsing the JSON text wasn't too difficult, but I'm not sure how display the text. I will need to display two things -- the title of the link and the link -- in a column style view. I was also planning on having two columns side by side to take advantage of the horizontal screen width. I've tried starting out with a Listbox, but that seemed to more be used if you want a selectable list. I just want to display the text and be done with it. Is there a different and more appropriate widget I should be using? I looked into the Entry widget a bit and thought that might be getting closer, but that seemed to only be for storing a single entry.
If you are using a sufficiently modern version of python (2.7, 3....something, I forget) you can use the ttk.Treeview widget which is similar to the listbox but supports multiple columns.
A much simpler choice is to use the text widget. You can insert the text followed by a newline. To line thimgs up in columns just insert a tab, and define an appropriate tab stop.
There are plenty of other options, but those two are arguably the best.
If you haven't dicovered it yet, tkdocs.com has a wealth of information about tkinter.

Categories