1.如果网格布局对象未指定具体的“行数”和“列数”,那么它将拥有1行和动态的列数. import java.awt.Button; import java.awt.Frame; import java.awt.GridLayout; public class TestGridLayout { public static void main(String[] args) { Frame f = new Frame("TestGridLayout" ); GridLayout gl = n
问题:重新格式化一些很长的字符串,以指定的列数来显示 解决方案:textwrap模块的fill()方法来实现 # A long string s = "Look into my eyes, look into my eyes, the eyes, the eyes, \ the eyes, not around the eyes, don't look around the eyes, \ look into my eyes, you're under." import textwra