Null-Terminator
Null-Terminator

Reputation: 25

How do you share data between a python script and a vb.net application?

I am writing a text-based game that uses a vb.net console application as the GUI. However, the game itself is actually running in python, because it is better for writing scripts. How do I send output from python to vb.net, and send the input obtained in the vb.net application to the python script? I will include my vb.net code here:

Public Module porkDisplay
  Class Err
    Private code As Integer
    Private str As String
    Public Sub New(ByVal code As Integer, ByVal str As String)
      Me.code = code
      Me.str = str
    End Sub
    Sub Run()
      REM Send Me.code to an error handling python script
      MsgBox(Me.str)
    End Sub
  End Class
  Class CommandIntepreter
    Private code As Integer
    Public Sub New(ByVal code As Integer)
      Me.code = code
    End Sub
    Sub GetData(ByVal data As String, ByVal runtimeerror As Err)
       If data.Length = 0 Then
          runtimeerror.Run()
       Else
          REM send data to python
       End If
    End Sub
  End Class
  Sub Main()
    Dim standardInput As CommandInterpreter = New CommandInterpreter(0)
    Dim nullInputErr As Err = New Err(0, "ERROR! Null Input Detected")
    Console.WriteLine("Good Morning")
    standardInput.GetData(Console.ReadLine(), nullInputErr)
  End Sub
End Module

Upvotes: 0

Views: 432

Answers (1)

DeepSpace
DeepSpace

Reputation: 81594

This is probably not a question in SO standards, but you could use almost everything, from a simple text or JSON file, via sockets to a local database.

Upvotes: 2

Related Questions