Groups
Sign in
Groups
spyder
Conversations
About
Send feedback
Help
How do you flush stdout?
18 views
Skip to first unread message
rssail
unread,
Apr 13, 2024, 12:30:22 PM
Apr 13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to spyder
I have the following:
import
sys
import
os
class
Portfolio
:
@classmethod
def
menu
(
cls
):
print
(
"Main Menu"
)
p = Portfolio()
p.clear_screen()
p.transaction()
def
clear_screen
(
self
):
os.system(
'cls'
if
os.name
==
'nt'
else
'clear'
)
print
(flush=
True
)
sys.stdout.flush()
def
transaction
(
self
):
print
(
"Transaction Menu"
)
if
__name__ ==
"__main__"
: Portfolio.menu()
When I run this the screen clears AFTER not BEFORE transaction() is run. How can I correct that?
Reply all
Reply to author
Forward
0 new messages