コード例 #1
0
ファイル: tests.py プロジェクト: keszybz/python-termsize
    def test_os_environ_first(self):
        "Check if environment variables have precedence"

        with support.EnvironmentVarGuard() as env:
            env['COLUMNS'] = '777'
            size = termsize.get_terminal_size()
        self.assertEqual(size.columns, 777)

        with support.EnvironmentVarGuard() as env:
            env['ROWS'] = '888'
            size = termsize.get_terminal_size()
        self.assertEqual(size.rows, 888)
コード例 #2
0
ファイル: tests.py プロジェクト: keszybz/python-termsize
    def test_os_environ_first(self):
        "Check if environment variables have precedence"

        with support.EnvironmentVarGuard() as env:
            env['COLUMNS'] = '777'
            size = termsize.get_terminal_size()
        self.assertEqual(size.columns, 777)

        with support.EnvironmentVarGuard() as env:
            env['ROWS'] = '888'
            size = termsize.get_terminal_size()
        self.assertEqual(size.rows, 888)
コード例 #3
0
ファイル: tests.py プロジェクト: keszybz/python-termsize
 def test_does_not_crash(self):
     # There's no easy portable way to actually check the size of
     # the terminal, so let's check if it returns something
     # sensible instead.
     size = termsize.get_terminal_size()
     self.assertGreater(size.columns, 0)
     self.assertGreater(size.rows, 0)
コード例 #4
0
ファイル: tests.py プロジェクト: keszybz/python-termsize
 def test_does_not_crash(self):
     # There's no easy portable way to actually check the size of
     # the terminal, so let's check if it returns something
     # sensible instead.
     size = termsize.get_terminal_size()
     self.assertGreater(size.columns, 0)
     self.assertGreater(size.rows, 0)
コード例 #5
0
ファイル: myclient.py プロジェクト: JamesWP/UNI-Y1-2
def printRight(message,color = ENDC):
  width = get_terminal_size()[0]
  padding = " " * (width - len(message) - 1)
  print color,
  print '\r',padding,message
  print ENDC,
コード例 #6
0
ファイル: wavemakerv1.py プロジェクト: banool/random-projects
            sys.exit()
    else:
        period = period_d
        print "Using %s for horizontal displacement" % str(period)

    max_i = raw_input("\nOptions: A number above 0\nmax_i: ")
    if max_i:
        try:
            #print "gg"
            max_i = int(max_i)
        except:
            print "Please enter an integer"
            question()
            sys.exit()
    else:
        max_i = max_i_d
        print "Using %s for max_i" % str(max_i)

question()

for i in range(0, max_i*10):
    i = i/10.0
    if waveType == "sin":
        f = math.sin
    else:
        f = math.cos
    b = (2*math.pi)/period
    pos = amplitude * f(i*((2*math.pi)/period) - displacement_horiz) + displacement_verti
    width = get_terminal_size()[0]
    print " " * int(pos*10 + width/2), "*"