WebCreator 2.0

Iniciado por Sajuuk, Mayo 12, 2015, 02:49:10 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Mayo 12, 2015, 02:49:10 PM Ultima modificación: Mayo 12, 2015, 04:01:28 PM por WhiZ
Hola a todos!

Decidí hacerle una gui (aprovechando el "GUI Eterno" [Dross]) a un viejo programa que el usuario Subzer creó hace un tiempecito.
Link a su programa: No tienes permitido ver los links. Registrarse o Entrar a mi cuenta


Funcionamiento:
El usuario ingresa las variables que la librería No tienes permitido ver los links. Registrarse o Entrar a mi cuenta usará para crear el archivo html.
En caso de exito, nos aparece un showinfo indicandonoslo, si no, un feo showerror nos aparecerá en nuestras pantallas.

El programa ya está testeado, y se le pueden añadir más cosas (como estilos CSS), pero preferí no modificarlo tanto.  ;D

2 archivos:

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Código: python

from tkinter import *
from tkinter.messagebox import showinfo, showerror
from webcreator import Pagina

class GUI(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.title("WebCreator v2.0")
        self.resizable(0,0)
        self.config(bg="black")

        topimg = PhotoImage(file="header.gif")
        t = Label(self, image=topimg, bg="white")
        t.image = topimg
        t.grid(row=0, column=0, columnspan=2, padx=5, pady=5)

        st = StringVar()
        st1 = StringVar()
        st2 = StringVar()
        st3 = StringVar()
        st4 = StringVar()
        st5 = StringVar()
        st6 = StringVar()
        st7 = StringVar()
        st8 = StringVar()
        st9 = StringVar()
        st10 = StringVar()
        st11 = StringVar()

        Label(self, text="Nombre de la página (html):", bg="black", fg="white").grid(row=1, column=0)
        self.page = Entry(self, textvariable=st, width=35)
        self.page.grid(row=1, column=1)

        Label(self, text="Título de la página:", bg="black", fg="white").grid(row=2, column=0)
        self.title = Entry(self, textvariable=st1, width=35)
        self.title.grid(row=2, column=1)

        Label(self, text="Color de fondo (pagina):", bg="black", fg="white").grid(row=3, column=0)
        self.color = Entry(self, textvariable=st2, width=35)
        self.color.grid(row=3, column=1)

        Label(self, text="Título <h1>:", bg="black", fg="white").grid(row=4, column=0)
        self.h1 = Entry(self, textvariable=st3, width=35)
        self.h1.grid(row=4, column=1)

        Label(self, text="Tamaño <h1> (0 - 200)", bg="black", fg="white").grid(row=5, column=0)
        self.tamh1 = Entry(self, textvariable=st4, width=35)
        self.tamh1.grid(row=5, column=1)

        Label(self, text="Color <h1> (ej: green):", bg="black", fg="white").grid(row=6, column=0)
        self.colorh1 = Entry(self, textvariable=st5, width=35)
        self.colorh1.grid(row=6, column=1)

        Label(self, text="URL de imagen central:", bg="black", fg="white").grid(row=7, column=0)
        self.url = Entry(self, textvariable=st6, width=35)
        self.url.grid(row=7, column=1)

        Label(self, text="Anchura de imagen:", bg="black", fg="white").grid(row=8, column=0)
        self.imganch = Entry(self, textvariable=st7, width=35)
        self.imganch.grid(row=8, column=1)

        Label(self, text="Altura de imagen:", bg="black", fg="white").grid(row=9, column=0)
        self.imgalt = Entry(self, textvariable=st8, width=35)
        self.imgalt.grid(row=9, column=1)

        Label(self, text="Texto (abajo de imagen):", bg="black", fg="white").grid(row=10, column=0)
        self.textdimg = Entry(self, textvariable=st9, width=35)
        self.textdimg.grid(row=10, column=1)

        Label(self, text="Tamaño de texto (img):", bg="black", fg="white").grid(row=11, column=0)
        self.tamtextimg = Entry(self, textvariable=st10, width=35)
        self.tamtextimg.grid(row=11, column=1)

        Label(self, text="Color de texto (img):", bg="black", fg="white").grid(row=12, column=0)
        self.colortextimg = Entry(self, textvariable=st11, width=35)
        self.colortextimg.grid(row=12, column=1)

        Button(self, text="Crear página!", command=self.create, bg="#545b58", fg="white").grid(row=13, column=0, columnspan=2, sticky=NSEW)

    def create(self):
        pagina = self.page.get()
        titulo = self.title.get()
        fondo = self.color.get()
        tam = self.tamh1.get()
        color = self.colorh1.get()
        text = self.h1.get()
        imagen1 = self.url.get()
        imagen2 = self.imganch.get()
        imagen3 = self.imgalt.get()
        textopeq1 = self.textdimg.get()
        textopeq = self.tamtextimg.get()
        textopeq2 = self.colortextimg.get()

        p = Pagina()
        r = p.crear(pagina, titulo, fondo, tam, color, text, imagen1, imagen2, imagen3, textopeq, textopeq1, textopeq2)
        if r == True:
            showinfo("Listo!", "Página %s creada!" % pagina)
        else:
            showerror("Error!", "La página no pudo ser creada")

GUI().mainloop()


No tienes permitido ver los links. Registrarse o Entrar a mi cuenta  (modificado para su uso en Python 3.4):
Código: python

#!/usr/bin/env python
####################
## PARA UNDERCODE ##
####################

#Version 1.5

body1 = "</body>"
html1 = "</html>"
title1 = "<title>"
title2 = "</title>"
style1 = "<style type='text/css'> <!-- body {background-color: "
style2 = ";} --> </style>"
tamano1 = "<center><font size='"
tamano3 = "' face='Arial' "
tamano2 = "' face='Impact' "
color1 = "color='"
color2 = " '>"
fuentend = "</font></center>"
img1 = "<center><img src='"
img2 = "' width='"
img3 = "' height='"
img4 = "'></center>"
saltolinea = "\n"


class Pagina():
    def crear(self, pagina, titulo, fondo, tam, color, text, imagen1, imagen2, imagen3, textopeq1, textopeq, textopeq2):
        create=open(pagina, 'w')
        create.write(body1 + saltolinea)
        create.write(html1 + saltolinea )
        create.write(title1 + titulo + title2 + saltolinea )
        create.write(style1 + fondo + style2 + saltolinea)
        create.write(tamano1 + tam + tamano2 + saltolinea)
        create.write(color1 + color + color2 + text + fuentend + saltolinea)
        create.write("<br>")
        create.write(img1 + imagen1 + img2 + imagen2 + img3 + imagen3 + img4 + saltolinea)
        create.write("<br>")
        create.write(tamano1 + textopeq1 + tamano3 + color1 + textopeq2 + color2 + textopeq + fuentend + saltolinea)
        create.write("<font size='5' face='Arial' color='white'><center><a href='http://underc0de.org/foro/index.php'>Underc[0]de Team.</a> </center></font><br>")
        create.close()

        return True



Fotos:




Archivos (e imagen): No tienes permitido ver los links. Registrarse o Entrar a mi cuenta


Saludos!