Fix GUI program tk module calling problem

This commit is contained in:
weijian 2023-04-17 15:14:32 +08:00
parent f29d7e1b72
commit 694b2472d7
11 changed files with 59 additions and 29 deletions

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time

View file

@ -1,7 +1,9 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import Tkinter as tk # python2
import tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -31,9 +34,9 @@ class Window:
self.hs = self.win.winfo_screenheight() # height of the screen
# calculate x and y coordinates for the Tk root window
# 计算 Tk 根窗口的 x 和 y 坐标
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x370+{}+{}".format(x, y))
x = int((self.ws / 2) - 190)
y = int((self.hs / 2) - 250)
self.win.geometry("430x400+{}+{}".format(x, y))
# layout,布局
self.set_layout()
# input section,输入部分

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -30,9 +33,9 @@ class Window:
self.ws = self.win.winfo_screenwidth() # width of the screen
self.hs = self.win.winfo_screenheight() # height of the screen
# calculate x and y coordinates for the Tk root window
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x370+{}+{}".format(x, y))
x = int((self.ws / 2) - 190)
y = int((self.hs / 2) - 250)
self.win.geometry("430x400+{}+{}".format(x, y))
# 布局
self.set_layout()
# 输入部分

View file

@ -1,7 +1,9 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import Tkinter as tk
import tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time

View file

@ -1,7 +1,9 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import Tkinter as tk
import tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -32,7 +35,7 @@ class Window:
# calculate x and y coordinates for the Tk root window
x = int((self.ws / 2) - 190)
y = int((self.hs / 2) - 250)
self.win.geometry("430x370+{}+{}".format(x, y))
self.win.geometry("430x400+{}+{}".format(x, y))
# 布局
self.set_layout()
# 输入部分

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -32,7 +35,7 @@ class Window:
# calculate x and y coordinates for the Tk root window
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x400+{}+{}".format(x, y))
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
# 布局
self.set_layout()
# 输入部分

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -32,7 +35,7 @@ class Window:
# calculate x and y coordinates for the Tk root window
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x400+{}+{}".format(x, y))
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
# 布局
self.set_layout()
# 输入部分

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mypalletizer_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -33,7 +36,7 @@ class Window:
# 计算 Tk 根窗口的 x 和 y 坐标
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x350+{}+{}".format(x, y))
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
# layout. 布局
self.set_layout()
# input. 输入部分

View file

@ -1,6 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Tkinter as tk
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
from mypalletizer_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
import rospy
import time
@ -33,7 +36,7 @@ class Window:
# 计算 Tk 根窗口的 x 和 y 坐标
x = (self.ws / 2) - 190
y = (self.hs / 2) - 250
self.win.geometry("430x350+{}+{}".format(x, y))
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
# layout. 布局
self.set_layout()
# input. 输入部分