GithubHelp home page GithubHelp logo

caligrafo's Introduction


  '''
  |||
  \\\          ___,
   \\\      .~´    `-,
    \\°    /  _    _ \.
     \°   ,\`|_|''|_|´\
      °    /          /)   °
          (\  ,    , .\`   |°
           `) ;`,; `,^,)   ||°
           ´,´  `,  `  `   |||
                            \\\
  ~ZVK                       |||
                             '''

caligrafo's People

Contributors

zvorky avatar

Stargazers

 avatar  avatar

Watchers

 avatar

caligrafo's Issues

Basic Implementation

  • Implement the Class Diagram in Python
  • TextBox.ConvertStr():
    • Basic Formatting
    • Width Limit
    • Height Limit
    • Width + Height Limit
    • Vertical Alignment
    • Horizontal Alignment
    • Vertical Spacing
    • Horizontal Spacing

Negative Margins

An idea is to implement Negative Spacing values, so we can make a text exceed the TextBox limits, but showing only whats inside it. It can turn some text animations and other exhibition styles easier.

Example:

text = TextBox('''
▒███████▒ ██▒   █▓ ▒█████   ██▀███   ██ ▄█▀▓██   ██▓
▒ ▒ ▒ ▄▀░▓██░   █▒▒██▒  ██▒▓██ ▒ ██▒ ██▄█▒  ▒██  ██▒
░ ▒ ▄▀▒░  ▓██  █▒░▒██░  ██▒▓██ ░▄█ ▒▓███▄░   ▒██ ██░
  ▄▀▒   ░  ▒██ █░░▒██   ██░▒██▀▀█▄  ▓██ █▄   ░ ▐██▓░
▒███████▒   ▒▀█░  ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄  ░ ██▒▓░
░▒▒ ▓░▒░▒   ░ ▐░  ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ ▓▒   ██▒▒▒ 
░░▒ ▒ ░ ▒   ░ ░░    ░ ▒ ▒░   ░▒ ░ ▒░░ ░▒ ▒░ ▓██ ░▒░ 
░ ░ ░ ░ ░     ░░  ░ ░ ░ ▒    ░░   ░ ░ ░░ ░  ▒ ▒ ░░  
  ░ ░          ░      ░ ░     ░     ░  ░    ░ ░     
░             ░                             ░ ░
''') 
text.spacing.top = -2
text.spacing.left = -3 # Haven't implemented a function for this yet, but if negative numbers were allowed, changing Spacing vars directly wouldn't have any problem :^) 
print(str(text))

Output:

 ▄▀▒░  ▓██  █▒░▒██░  ██▒▓██ ░▄█ ▒▓███▄░   ▒██ ██░
▀▒   ░  ▒██ █░░▒██   ██░▒██▀▀█▄  ▓██ █▄   ░ ▐██▓░
█████▒   ▒▀█░  ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄  ░ ██▒▓░
 ▓░▒░▒   ░ ▐░  ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ ▓▒   ██▒▒▒ 
 ▒ ░ ▒   ░ ░░    ░ ▒ ▒░   ░▒ ░ ▒░░ ░▒ ▒░ ▓██ ░▒░ 
 ░ ░ ░     ░░  ░ ░ ░ ▒    ░░   ░ ░ ░░ ░  ▒ ▒ ░░  
 ░          ░      ░ ░     ░     ░  ░    ░ ░     
           ░                             ░ ░

as the str(text) is a product from TextBox text, the string inside the TextBox is not affected, so we can change the spacing again:

text.spacing.top = 0
text.spacing.bottom = -4
text.spacing.left = 3
text.spacing.right = -6

print(str(text))

Output:

   ▒███████▒ ██▒   █▓ ▒█████   ██▀███   ██ ▄█▀▓██
   ▒ ▒ ▒ ▄▀░▓██░   █▒▒██▒  ██▒▓██ ▒ ██▒ ██▄█▒  ▒█
   ░ ▒ ▄▀▒░  ▓██  █▒░▒██░  ██▒▓██ ░▄█ ▒▓███▄░   ▒
     ▄▀▒   ░  ▒██ █░░▒██   ██░▒██▀▀█▄  ▓██ █▄   ░
   ▒███████▒   ▒▀█░  ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄  ░
   ░▒▒ ▓░▒░▒   ░ ▐░  ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ ▓▒   

So in a Left-Aligned TextBox (default), the difference between a negative bottom margin and a height limit is that the height limit would put a Limit Message (default: "[...]") into the end, but just if it exceeds the height, a negative bottom in a non-limited box is relative its end.

text.spacing.bottom = 0
text.height = 6
print(str(text))

Output:

   ▒███████▒ ██▒   █▓ ▒█████   ██▀███   ██ ▄█▀▓██
   ▒ ▒ ▒ ▄▀░▓██░   █▒▒██▒  ██▒▓██ ▒ ██▒ ██▄█▒  ▒█
   ░ ▒ ▄▀▒░  ▓██  █▒░▒██░  ██▒▓██ ░▄█ ▒▓███▄░   ▒
     ▄▀▒   ░  ▒██ █░░▒██   ██░▒██▀▀█▄  ▓██ █▄   ░
   ▒███████▒   ▒▀█░  ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄  ░
   ░▒▒ ▓░▒░▒   ░ ▐░  ░ ▒░▒░▒░ ░ ▒▓ ░▒▓░▒ ▒▒ [...]

And the difference between a negative right margin and a width limit is that when the width exceeds, it breaks the line, so we would have a sadly broken ASCII art:

text.SetMargin(0) # Set all margins 0
text.width = 46
print(str(text))

Output:

▒███████▒ ██▒   █▓ ▒█████   ██▀███   ██ ▄█▀▓██
   ██▓
▒ ▒ ▒ ▄▀░▓██░   █▒▒██▒  ██▒▓██ ▒ ██▒ ██▄█▒  ▒█
█  ██▒
░ ▒ ▄▀▒░  ▓██  █▒░▒██░  ██▒▓██ ░▄█ ▒▓███▄░   ▒
██ ██░                                   [...]

Must consider that positioning is not implemented, so we can't put aside other TextBox yet. :/

Planning

  • The Idea
  • The Code
  • Basic Utilities
  • General Requirements
  • Data Structure

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.