|
View:
New views
10 Messages
—
Rating Filter:
Alert me
|
|
|
How do I format outputted text?How can I control the format (font size, color and location) for text that I am out-putting to the screen. For example: puts ("Ruby is great!") How can I make this appear in larger font on my screen when I run my program? Any help would be GREATLY appreciated!! dm -- Posted via http://www.ruby-forum.com/. |
|
|
Re: How do I format outputted text?Dan Mariani wrote:
> How can I control the format (font size, color and location) for text > that I am out-putting to the screen. For example: > > puts ("Ruby is great!") > > How can I make this appear in larger font on my screen when I run my > program? > > Any help would be GREATLY appreciated!! > > dm What environment are you running the program in? Are you using a GUI toolkit? Are you just printing to the console? Are you (trying) to get this functionality in TextMate? What operating system are you using? Do you need a portable program? See http://catb.org/~esr/faqs/smart-questions.html Dan |
|
|
Re: How do I format outputted text?you could just put it in all capitals
2007/8/29, Dan Mariani <dmariani586@...>: > > > How can I control the format (font size, color and location) for text > that I am out-putting to the screen. For example: > > puts ("Ruby is great!") > > How can I make this appear in larger font on my screen when I run my > program? > > Any help would be GREATLY appreciated!! > > dm > -- > Posted via http://www.ruby-forum.com/. > > -- fish can't fly but birds can birds can't swim but fish can |
|
|
Re: How do I format outputted text?On Aug 29, 2007, at 10:06 PM, smc smc wrote:
> fish can't fly but birds can > birds can't swim but fish can Therefore, penguins are fish :) Regards, Morton |
|
|
Re: How do I format outputted text?Dan Zwell wrote:
> Dan Mariani wrote: >> dm > What environment are you running the program in? A: I am running the program from the DOS Command Prompt. Are you using a GUI toolkit? A: No, I don't even know what one is. I am new to both programming and Ruby. Are you just printing to the console? A: Yes, I am just printing to the console. Are you (trying) to get this functionality in TextMate? A: I am not familiar with TextMate. What operating system are you using? A: Windows XP Do you need a portable program? A: Yes, I would prefer that it be portable. > > See http://catb.org/~esr/faqs/smart-questions.html > > Dan Thanks for the help! -- Posted via http://www.ruby-forum.com/. |
|
|
Re: How do I format outputted text?Dan Mariani wrote:
> > How can I control the format (font size, color and location) for text > that I am out-putting to the screen. For example: > > puts ("Ruby is great!") > > How can I make this appear in larger font on my screen when I run my > program? > > Any help would be GREATLY appreciated!! > > dm > -- > Posted via http://www.ruby-forum.com/. > > > Dan Zwell wrote: >> Dan Mariani wrote: >>> dm >> What environment are you running the program in? > A: I am running the program from the DOS Command Prompt. > Command Prompts don't generally support multiple fonts on screen, it basically emulates a TTY < http://en.wikipedia.org/wiki/Teletypewriter >. You can change what font your command prompt displays stuff in, but your program can not really do it for you the way you intend for it to do so. Most Command Line Interfaces can support colours and bold text -> but doing that is not very portable. Typically it involves using the curses library (which tries to make such things portable between UNIX systems) or DOS/Windows API instructions (only portable between those systems). Other Operating System families would have their own way of doing it. Doing such things as displaying the things in multiple fonts, sizes, colours, styles e.t.c. can be done by creating a GUI program instead of a console one, or even a Web Application with Ruby on Rails. > Are you using a GUI toolkit? > A: No, I don't even know what one is. I am new to both programming and > Ruby. > A GUI (Graphical User Interface) toolkit is a collection of code that makes it easier to write a program that runs within a 'Window' on your screen, like how most programs do (notepad, internet explorer, word, e.t.c.). Without a GUI toolkit, every one would have to write the code to create a 'window' on screen them selves and they'd never look the same... Like how Programmers used to have to write their own puts() methods if they wanted to put stuff to the command prompt :S > Are you just printing to the console? > A: Yes, I am just printing to the console. > > Are you (trying) to get this functionality in TextMate? > A: I am not familiar with TextMate. > TextMate is a feature full text editor for Mac OS X popular with programmers. > What operating system are you using? > A: Windows XP > > Do you need a portable program? > A: Yes, I would prefer that it be portable. Basic input/output to and from the system console is usually pretty portable in most high level languages created since the 1970s / 1980s. Some things are not but simple stuff l >> >> See http://catb.org/~esr/faqs/smart-questions.html >> >> Dan This link is very valuable > > Thanks for the help! > > > -- > Posted via http://www.ruby-forum.com/. > > We are all new once, most regular people are to young to know every thing about computers and even the oldest geeks probably have yet to learn it all. As you learn more, you'll grow deeper in the force. Learning to ask questions that make it easier for people to help you, will increase your chances of success... Rather then meeting up with a few people that have probably yet to stop laughing at a beginners question and hopefully not post remarks =/ PS: No offense to any of the other people on this mailing list with that last sentence. -- Email and shopping with the feelgood factor! 55% of income to good causes. http://www.ippimail.com |
|
|
Re: How do I format outputted text?Dan Mariani wrote:
> Dan Zwell wrote: >> Dan Mariani wrote: >>> dm >> What environment are you running the program in? > A: I am running the program from the DOS Command Prompt. > > Are you using a GUI toolkit? > A: No, I don't even know what one is. I am new to both programming and > Ruby. > > Are you just printing to the console? > A: Yes, I am just printing to the console. When printing to the console, the simplest case is that you add spaces or newlines. 10.times { puts } puts (" " * 20) + "This is in the middle of the screen" 10.times { puts } Being that most text mode programs print one line at a time, there isn't an easier way. Perhaps you could write a method that printed 30 lines at a time, if you wanted the illusion of being able to print to various parts of the screen. A lot of people use simple ideas like printing blank lines or loud characters to get the eye's attention. You can't change the font, but there's a lot you can do to effectively communicate. Some examples: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ !!!!!! Are you sure? !!!!!!!!! ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== Started......... To do more with screen positioning, there is a library called ncurses that gives you complete flexibility to place anything anywhere on the screen. This is really the standard for complex console output. The homepage for ncurses-ruby is here: http://ncurses-ruby.berlios.de/ , and I saw what looked like a Windows package, but I don't know whether that means you can install it without cygwin (Linux emulation, basically). Learning to use this library might be too much to learn at once for a beginner to programming, but know that this is the most powerful tool (that can be used with Ruby) for doing layout stuff on the console. If you will be content with being able to change colors, I would go for a library called HighLine (http://highline.rubyforge.org/). See the examples here http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/trunk/highline/examples/?root=highline for descriptions of how it can be used. You can find documentation from the first link. Good luck, Dan |
|
|
Re: How do I format outputted text?Hi, Am Donnerstag, 30. Aug 2007, 10:31:29 +0900 schrieb Dan Mariani: > > puts ("Ruby is great!") > > How can I make this appear in larger font on my screen when I run my > program? IO.popen "figlet", "w" do |f| f.puts "Ruby is great!" end <http://www.google.de/search?q=figlet> Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de |
|
|
Re: How do I format outputted text?Dan Mariani wrote:
> > How can I control the format (font size, color and location) for text > that I am out-putting to the screen. For example: > > puts ("Ruby is great!") > > How can I make this appear in larger font on my screen when I run my > program? > > Any help would be GREATLY appreciated!! > > dm Doing it in console, you can't format it. There are GUI toolkits like FXRuby you can checkout or just do a google search for GUI toolkits for Ruby. If you do Rails development on MacOSX there is a gem that allows you to have your text in different colors for your log file. Being new to all this stuff, that may be a bit too much, but just keep it in mind if you ever get into Rails development, then hop back on here and ask the question again :) ~Jeremy -- Posted via http://www.ruby-forum.com/. |
|
|
Re: How do I format outputted text?Jeremy Woertink wrote:
> Dan Mariani wrote: > >> How can I control the format (font size, color and location) for text >> that I am out-putting to the screen. For example: >> >> puts ("Ruby is great!") >> >> How can I make this appear in larger font on my screen when I run my >> program? >> >> Any help would be GREATLY appreciated!! >> >> dm >> > > Doing it in console, you can't format it. There are GUI toolkits like > FXRuby you can checkout or just do a google search for GUI toolkits for > Ruby. If you do Rails development on MacOSX there is a gem that allows > you to have your text in different colors for your log file. Being new > to all this stuff, that may be a bit too much, but just keep it in mind > if you ever get into Rails development, then hop back on here and ask > the question again :) > > > ~Jeremy > Or you could use WideStudio [1] to make Ruby based executable programs in a GUI style! [1] www.widestudio.org Cheers, Mohit. 9/3/2007 | 11:33 PM. |
| Free embeddable forum powered by Nabble | Forum Help |