From 99365ad4d03cee87749869b876cdd7bf259a963a Mon Sep 17 00:00:00 2001 From: luisgulo Date: Tue, 10 Oct 2023 00:06:31 +0200 Subject: [PATCH] Codigo python --- gnuSnapCode.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 gnuSnapCode.py diff --git a/gnuSnapCode.py b/gnuSnapCode.py new file mode 100644 index 0000000..a8981b0 --- /dev/null +++ b/gnuSnapCode.py @@ -0,0 +1,27 @@ +#!/usr/bin/python +from pygments import highlight +from pygments.lexers import get_lexer_by_name +from pygments.formatters import ImageFormatter +from pygments.formatters.img import PilNotAvailable + +lenguaje = get_lexer_by_name("python", stripall=True) + +trozo_codigo = """ +from pygments import highlight +from pygments.lexers import get_lexer_by_name +from pygments.formatters import ImageFormatter +from pygments.formatters.img import PilNotAvailable + +lenguaje = get_lexer_by_name("python", stripall=True) + +trozo_codigo = ""\" +... +... + +""\" + +img = highlight(trozo_codigo, lenguaje, ImageFormatter(style='material'), outfile="codigo.png") + +""" + +img = highlight(trozo_codigo, lenguaje, ImageFormatter(style='material'), outfile="codigo.png")