Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ring Creating Reports using the WebLib and the GUILib

load "stdlib.ring"
load "weblib.ring"
load "guilib.ring"

import System.Web
import System.GUI

new qApp {
        open_window(:CustomersReportController)
        exec()
}

class CustomersReportController from WindowsControllerParent

        oView = new CustomersReportView

        func Start
                CreateReport()

        func CreateReport
                mypage = new HtmlPage {
                        h1 { text("Customers Report") }
                        Table
                        {
                                style = stylewidth("100%") + stylegradient(4)
                                TR
                                {
                                        TD { WIDTH="10%"
                                                text("Customers Count : " )  }
                                        TD { text (100) }
                                }
                        }
                        Table
                        {
                                style = stylewidth("100%") + stylegradient(26)
                                TR
                                {
                                        style = stylewidth("100%") +
                                                stylegradient(24)
                                        TD { text("Name " )  }
                                        TD { text("Age" ) }
                                        TD { text("Country" ) }
                                        TD { text("Job" ) }
                                        TD { text("Company" ) }
                                }
                                for x =  1 to 100
                                        TR
                                        {
                                                TD { text("Test" )  }
                                                TD { text("30" ) }
                                                TD { text("Egypt" ) }
                                                TD { text("Sales" ) }
                                                TD { text("Future" ) }
                                        }
                                next
                        }
                }
                write("report.html",mypage.output())

        func PrintEvent
                printer1 = new qPrinter(0) {
                        setoutputformat(1)
                        setoutputfilename("report.pdf")
                }
                oView {
                        web.print(printer1, Method( :OpenPDF ) )
                        web.show()
                }

        func OpenPDF
                new QDesktopServices {
                        OpenURL(new qURL("report.pdf") )
                }

class CustomersReportView

                win = new window() {
                                setwindowtitle("Report Window")
                                setgeometry(100,100,500,500)
                                web = new webview(win) {
                                        setgeometry(100,100,1000,500)
                                        loadpage(new qurl("file:///"+
                                        currentdir()+"/report.html"))
                                }
                                new pushbutton(win) {
                                                setGeometry(100,20,100,30)
                                                settext("Print")
                                                setclickevent(Method(:PrintEvent))
                                }
                                showMaximized()
                        }
Comment

PREVIOUS NEXT
Code Example
Python :: notebook prevent cell output 
Python :: how to get only the string of the input not the spaces arournd it in python 
Python :: get correlation between two signals 1d scipy 
Python :: All objects and constants needed to use the ldap3 library can be imported from the ldap3 namespace 
Python :: pairplot seaborn legend best position set 
Python :: sumy library 
Python :: python you can think pad baldi 
Python :: set change order python 
Python :: what is primary key in python 
Python :: pandas to sql arabic 
Python :: re.split return none in the list 
Python :: plt.axes muktiple plots 
Python :: get picamera feed 
Python :: django how to create superuser if does not exists on migration 
Python :: set constructor python 
Python :: cant import flask mail 
Python :: convert int to binary python 
Python :: code help 
Python :: jupyter notebook do not show matplotlib text above plot 
Python :: what does alpha in plt.txt do 
Python :: colab erase recycle bin drive 
Python :: insert string into middle of list python 
Python :: pandas backward fill after upsampling 
Python :: deploy vue app to google cloud run 
Python :: python slicing string 
Python :: mysql connector select 
Python :: normalize a distribution plot 
Python :: scrapping components of webpage 
Python :: How to subtract all the numbers in a list from the first number? 
Python :: when to use static method in python 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =