Giter VIP home page Giter VIP logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
Hi, thanks for this suggestion.

I have made changes to the SVN trunk such that it is now partially possible to 
get the styles you want.

The "hrules" attribute, which could previously take values FRAME, ALL or NONE 
can now also be set to HEADER, which prints a hrule only under the header, like 
your first example.

In addition to the old "hrules" attribute, there is now also "vrules", which 
can be take values FRAME, ALL or NONE.

By setting hrules=HEADER and vrules=NONE, along with horizontal_character="=" 
and junction_character="=", it should be possible to achieve the first example 
table you gave.

By setting hrules=FRAME and vrules=FRAME, you can get something close to your 
second example, the only difference being that you still won't have - as the 
horizontal character for the frame and = as the horizontal character for the 
header.

I may add the option for two different kind of horizontal characters, or I may 
not, I am not sure yet.  It seems harmless enough, but if I do that, then 
somebody will want the ability to, e.g, make a table like this:

+=====+=====+
| Foo . Bar |
+-----+-----+
|  1  .  2  |
+=====+=====+

i.e. where the external rules are different from the internal rules, and then 
if I do that somebody will want something else, and before you know it instead 
of just horizontal_char, vertical_char and junction_char there will have to be 
12 different attributes controlling the way lines are drawn to cover all the 
edge cases...

In general I am not opposed to putting in stuff to let people tweak their 
tables in all the little ways they want, but only if that doesn't make it 
difficult for the majority of people to do simple things.  If someone just 
wants to use, say, "=" as their horizontal line everywhere, they should be able 
to do that by setting one attribute, and should not be forced to set 3 or 4 
attributes corresponding to all the different kinds of horizontal line if they 
don't care about the differences.

Original comment by [email protected] on 22 Jan 2013 at 12:43

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
First of all, thank you very much.

About the way prettytable works, I think that you should distinguish among:

* header line
* frame border
* horizontal rules
* vertical rules

I personally thing that controlling independently if these components of the 
table should be showed or not is more important than using '&' for the 
horizontal lines, which would produce a ugly table, plain and simple :). 

I also think that if vrules==FRAME, then the code should not use the standard 
junction_char but use the horizontal_char instead. The following code, for 
example:


    import prettytable as pt

    p = pt.PrettyTable()
    p.add_row(range(4))
    p.add_row(range(5,9))

    p.hrules=pt.ALL
    p.vrules=pt.FRAME
    print p

should produce the following result:

+---------------------------------------+
| Field 1   Field 2   Field 3   Field 4 |
+---------------------------------------+
|    0         1         2         3    |
+---------------------------------------+
|    5         6         7         8    |
+---------------------------------------+

instead of

+---------+---------+---------+---------+
| Field 1   Field 2   Field 3   Field 4 |
+---------+---------+---------+---------+
|    0         1         2         3    |
+---------+---------+---------+---------+
|    5         6         7         8    |
+---------+---------+---------+---------+



Original comment by [email protected] on 22 Jan 2013 at 8:26

Attachments:

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024

Original comment by [email protected] on 18 Feb 2013 at 7:12

  • Changed title: Changes to border line styes [was: Requests for enhancement]

from prettytable.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 18, 2024
I've made changes in trunk which fix the issue with printing spurious junction 
characters as part of the horizontal lines when vrules is set to FRAME.  Thanks 
for pointing out this shortcoming.

Original comment by [email protected] on 19 Feb 2013 at 5:38

from prettytable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.