How to elegantly work with a lot of print functions?

Posted by user1824372 on Programmers See other posts from Programmers or by user1824372
Published on 2013-09-09T21:11:04Z Indexed on 2013/11/09 22:09 UTC
Read the original article Hit count: 157

Filed under:
|
|

I'm working on a Python project that is executed on a terminal (or console) for which I am planning to implement a GUI.

I did not major in CS so I really have no idea how to effectively design a terminal GUI such that:

  1. the user interface looks good
  2. in GUI, it is directed to a certain widget, let's say, a text label, or a bottom bar, or a hide-able frame.

Do you have any suggestions?

Currently, I am using the print function to provide essential information on STDOUT during execution, so a lot of print calls are distributed here and there in the code.

I'm thinking of using macro-like variables such as 'FILE_NOT_EXISTS_MESSAGE' for printing, and all of them and their values would be defined in one file.

Is that a standard way to do this?

Should I introduce a logging system?

In summary, I'm looking for a pattern for handling console output that is effective and adaptable.

© Programmers or respective owner

Related posts about design-patterns

Related posts about python