mirror of
https://github.com/elephantrobotics/mycobot_ros.git
synced 2026-07-05 19:47:04 +00:00
Fix GUI program tk module calling problem
This commit is contained in:
parent
f29d7e1b72
commit
694b2472d7
11 changed files with 59 additions and 29 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# import Tkinter as tk # python2
|
try:
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
except ImportError:
|
||||||
|
import Tkinter as tk
|
||||||
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -31,9 +34,9 @@ class Window:
|
||||||
self.hs = self.win.winfo_screenheight() # height of the screen
|
self.hs = self.win.winfo_screenheight() # height of the screen
|
||||||
# calculate x and y coordinates for the Tk root window
|
# calculate x and y coordinates for the Tk root window
|
||||||
# 计算 Tk 根窗口的 x 和 y 坐标
|
# 计算 Tk 根窗口的 x 和 y 坐标
|
||||||
x = (self.ws / 2) - 190
|
x = int((self.ws / 2) - 190)
|
||||||
y = (self.hs / 2) - 250
|
y = int((self.hs / 2) - 250)
|
||||||
self.win.geometry("430x370+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(x, y))
|
||||||
# layout,布局
|
# layout,布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# input section,输入部分
|
# input section,输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -30,9 +33,9 @@ class Window:
|
||||||
self.ws = self.win.winfo_screenwidth() # width of the screen
|
self.ws = self.win.winfo_screenwidth() # width of the screen
|
||||||
self.hs = self.win.winfo_screenheight() # height of the screen
|
self.hs = self.win.winfo_screenheight() # height of the screen
|
||||||
# calculate x and y coordinates for the Tk root window
|
# calculate x and y coordinates for the Tk root window
|
||||||
x = (self.ws / 2) - 190
|
x = int((self.ws / 2) - 190)
|
||||||
y = (self.hs / 2) - 250
|
y = int((self.hs / 2) - 250)
|
||||||
self.win.geometry("430x370+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(x, y))
|
||||||
# 布局
|
# 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# 输入部分
|
# 输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# import Tkinter as tk
|
try:
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
except ImportError:
|
||||||
|
import Tkinter as tk
|
||||||
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# import Tkinter as tk
|
try:
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
except ImportError:
|
||||||
|
import Tkinter as tk
|
||||||
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -32,7 +35,7 @@ class Window:
|
||||||
# calculate x and y coordinates for the Tk root window
|
# calculate x and y coordinates for the Tk root window
|
||||||
x = int((self.ws / 2) - 190)
|
x = int((self.ws / 2) - 190)
|
||||||
y = int((self.hs / 2) - 250)
|
y = int((self.hs / 2) - 250)
|
||||||
self.win.geometry("430x370+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(x, y))
|
||||||
# 布局
|
# 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# 输入部分
|
# 输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -32,7 +35,7 @@ class Window:
|
||||||
# calculate x and y coordinates for the Tk root window
|
# calculate x and y coordinates for the Tk root window
|
||||||
x = (self.ws / 2) - 190
|
x = (self.ws / 2) - 190
|
||||||
y = (self.hs / 2) - 250
|
y = (self.hs / 2) - 250
|
||||||
self.win.geometry("430x400+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
|
||||||
# 布局
|
# 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# 输入部分
|
# 输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mycobot_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -32,7 +35,7 @@ class Window:
|
||||||
# calculate x and y coordinates for the Tk root window
|
# calculate x and y coordinates for the Tk root window
|
||||||
x = (self.ws / 2) - 190
|
x = (self.ws / 2) - 190
|
||||||
y = (self.hs / 2) - 250
|
y = (self.hs / 2) - 250
|
||||||
self.win.geometry("430x400+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
|
||||||
# 布局
|
# 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# 输入部分
|
# 输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mypalletizer_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -33,7 +36,7 @@ class Window:
|
||||||
# 计算 Tk 根窗口的 x 和 y 坐标
|
# 计算 Tk 根窗口的 x 和 y 坐标
|
||||||
x = (self.ws / 2) - 190
|
x = (self.ws / 2) - 190
|
||||||
y = (self.hs / 2) - 250
|
y = (self.hs / 2) - 250
|
||||||
self.win.geometry("430x350+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
|
||||||
# layout. 布局
|
# layout. 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# input. 输入部分
|
# input. 输入部分
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
from mypalletizer_communication.srv import GetCoords, SetCoords, GetAngles, SetAngles, GripperStatus
|
||||||
import rospy
|
import rospy
|
||||||
import time
|
import time
|
||||||
|
|
@ -33,7 +36,7 @@ class Window:
|
||||||
# 计算 Tk 根窗口的 x 和 y 坐标
|
# 计算 Tk 根窗口的 x 和 y 坐标
|
||||||
x = (self.ws / 2) - 190
|
x = (self.ws / 2) - 190
|
||||||
y = (self.hs / 2) - 250
|
y = (self.hs / 2) - 250
|
||||||
self.win.geometry("430x350+{}+{}".format(x, y))
|
self.win.geometry("430x400+{}+{}".format(int(x), int(y)))
|
||||||
# layout. 布局
|
# layout. 布局
|
||||||
self.set_layout()
|
self.set_layout()
|
||||||
# input. 输入部分
|
# input. 输入部分
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue