python: Updated examples to use new code

pull/1662/head
igo95862 3 years ago committed by Nick Black
parent b678742f68
commit fb9b326e18

@ -13,6 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from notcurses import get_notcurses_version
from notcurses import notcurses_version
print(get_notcurses_version())
print(notcurses_version())

@ -15,8 +15,8 @@
# limitations under the License.
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
std_plane = get_std_plane()
Notcurses()
sleep(1)

@ -16,11 +16,13 @@
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
std_plane = get_std_plane()
std_plane.putstr("Hello, World!")
nc = Notcurses()
std_plane.context.render()
stdplane = nc.stdplane()
stdplane.putstr("Hello, World!")
sleep(5)
nc.render()
sleep(3)

@ -16,21 +16,24 @@
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
std_plane = get_std_plane()
std_plane.set_background_rgb(0, 0, 255)
std_plane.set_foreground_rgb(255, 0, 0)
std_plane.putstr("Red on blue", y_pos=0)
std_plane.set_background_rgb(0, 255, 0)
std_plane.set_foreground_rgb(255, 255, 255)
std_plane.putstr("White on green", y_pos=1, x_pos=0)
nc = Notcurses()
std_plane.set_background_rgb(0, 0, 0)
std_plane.set_foreground_rgb(255, 0, 255)
std_plane.putstr("Purple on black", y_pos=2, x_pos=0)
stdplane = nc.stdplane()
stdplane.set_bg_rgb8_clipped(0, 0, 255)
stdplane.set_fg_rgb8_clipped(255, 0, 0)
stdplane.putstr_yx(0, 0, "Red on blue")
std_plane.context.render()
stdplane.set_bg_rgb8(0, 255, 0)
stdplane.set_fg_rgb8(255, 255, 255)
stdplane.putstr_yx(1, 0, "White on green")
stdplane.set_bg_rgb8(0, 0, 0)
stdplane.set_fg_rgb8(255, 0, 255)
stdplane.putstr_yx(2, 0, "Purple on black")
nc.render()
sleep(5)

@ -15,21 +15,23 @@
# limitations under the License.
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
std_plane = get_std_plane()
nc = Notcurses()
stdplane = nc.stdplane()
red = 0x80
green = 0x80
blue = 0x80
y_dimension, x_dimension = std_plane.dimensions_yx
y_dimension, x_dimension = stdplane.dim_yx()
for y in range(y_dimension):
for x in range(x_dimension):
std_plane.set_foreground_rgb(red, green, blue)
std_plane.set_background_rgb(blue, red, green)
std_plane.putstr('X', y_pos=y, x_pos=x)
stdplane.set_fg_rgb8(red, green, blue)
stdplane.set_bg_rgb8(blue, red, green)
stdplane.putstr_yx(y, x, 'X')
blue += 2
if blue == 256:
blue = 0
@ -39,6 +41,6 @@ for y in range(y_dimension):
red = (red + 2) % 256
std_plane.context.render()
nc.render()
sleep(5)

@ -17,21 +17,29 @@
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
std_plane = get_std_plane()
nc = Notcurses()
sub_plane_left = std_plane.create_sub_plane()
stdplane = nc.stdplane()
sub_plane_right = std_plane.create_sub_plane(
x_pos=(std_plane.dimensions_yx[1] // 2))
sub_plane_left = stdplane.create(
rows=5,
cols=5,
)
sub_plane_left.set_foreground_rgb(0, 255, 0)
sub_plane_right = stdplane.create(
x_pos=(stdplane.dim_x() // 2),
rows=5,
cols=5,
)
sub_plane_left.set_fg_rgb8(0, 255, 0)
sub_plane_left.putstr("Left")
sub_plane_right.set_foreground_rgb(255, 0, 0)
sub_plane_right.set_fg_rgb8(255, 0, 0)
sub_plane_right.putstr("Right")
std_plane.context.render()
nc.render()
sleep(4)
sleep(3)

@ -17,8 +17,11 @@
from time import sleep
from notcurses import get_std_plane
from notcurses import Notcurses
nc = Notcurses()
stdplane = nc.stdplane()
test_str = '''Sapiente quaerat expedita repellendus ea quae. Ut enim natus iure laborum. Assumenda sed placeat provident similique cum quidem. Sit voluptas facilis vitae culpa asperiores eos neque.
Aspernatur rerum quae minus natus. Vero autem suscipit nisi eligendi dolorum sed vero. Illum odio repudiandae odit in voluptas reiciendis amet.
@ -27,10 +30,8 @@ Laboriosam expedita ut enim velit occaecati qui neque. Et voluptatem eligendi ha
Dolores quaerat sint dolorum. Corrupti temporibus nam corrupti. Iusto non perspiciatis et quisquam minima nesciunt quia esse.
'''
std_plane = get_std_plane()
std_plane.put_lines(test_str.splitlines(), wrap_lines=True)
wr = stdplane.puttext(-1, 0, test_str)
std_plane.context.render()
nc.render()
sleep(3)

Loading…
Cancel
Save