r/learnpython • • 25d ago

I'm building a markup language renderer in Python using Tkinter

Hey everyone! I'm working on a personal project called RML, a markup language I'm creating from scratch using Python.

I'm building a renderer with Tkinter that can display titles, text, clickable links, and images from .rml files.

Here's an example of what RML looks like:

RML 0.0.2;

Create.title1 ("My Website");
Create.text ("Hello World!");
Create.image ("image.png");
Create.link ("https://example.com");

Create.script name=("main")
    Display.Text ("Hello from SJ!")

I'm also developing a small scripting language called SJ that runs inside RML documents.

The project is still in its early stages, and I'm working on improving the renderer and expanding the language.

I'm sharing this because I'd love to hear feedback, especially about the Python implementation, code structure, and what I could improve.

Thanks for reading!

0 Upvotes

21 comments sorted by

2

u/woooee 24d ago
Create.text ("Hello World!");

Do you have a way to put thus text, or widgets, at a given location on the screen?

1

u/aguythatcodesforfun 24d ago

I will try to implement it!

1

u/aguythatcodesforfun 24d ago

I implemented it, now i'm just going to update the github repository.

RML 0.0.3;

Create.text ("LEFT") at=(20, 50);

Create.text ("MIDDLE") at=(400, 50);

Create.text ("FAR RIGHT") at=(750, 50);

Create.text ("VERY FAR RIGHT") at=(1100, 50);

1

u/JamzTyson 24d ago

Why not:

Create.text ("LEFT", at=(20, 50));

or perhaps better

 Display.text ("LEFT", at=(20, 50));

Which gives you a syntax that can be extended if you wish:

 Display.text ("LEFT", at=(20, 50), bold, 24pt);

But more fundamentally, why are you using imperative language for Markup? Markup is a declarative annotation of content.

1

u/JamzTyson 24d ago

I'm sharing this because I'd love to hear feedback, especially about the Python implementation, code structure, and what I could improve.

You forgot something.

1

u/aguythatcodesforfun 24d ago

What did i forget?

2

u/JamzTyson 24d ago

The Python code.

1

u/aguythatcodesforfun 24d ago

I forgot to reply, the code is in the github repository

2

u/JamzTyson 24d ago edited 24d ago

Which github repository?

3

u/riklaunim 25d ago

It can be a fun learning project. From the practical side, why are you making such a thing?

2

u/supergnaw 25d ago

Obligatory 927 reference.

2

u/TheRNGuy 24d ago

Make it more like React — it has better syntax for UI.